A pile of apples, after dividing it into three small piles, there is still one apple left; then take out a small pile, divide it into three small piles, and there is one apple left, and at this time there are 4 apples in each small pile ． Question: How many apples are there in the original pile?
一堆苹果，将它平均分成三小堆后，还剩一个苹果；再取出其中的一小堆，再平均分成三小堆，又剩一个苹果，并且此时每一小堆中有4个苹果．问：原来一大堆苹果有多少个？
<gadget id="calculator">4 * 3</gadget>
<output>12</output>

<gadget id="calculator">12 + 1</gadget>
<output>13</output>

<gadget id="calculator">13 * 3</gadget>
<output>39</output>

<gadget id="calculator">39 + 1</gadget>
<output>40</output>

<result>40</result>