A four-layer pyramid is being built with each layer having three times as many sandstone blocks as the layer above it. The top layer is a single block. How many sandstone blocks are in the pyramid?
There are 1 * 3 = 
<gadget id="calculator">1*3</gadget>
<output>3</output>
3 blocks in the second layer.
There are 3 * 3 = 
<gadget id="calculator">3*3</gadget>
<output>9</output>
9 blocks in the third layer.
There are 9 * 3 = 
<gadget id="calculator">9*3</gadget>
<output>27</output>
27 blocks in the fourth layer.
Thus, there are 1 + 3 + 9 + 27 = 
<gadget id="calculator">1+3+9+27</gadget>
<output>40</output>
40 sandstone blocks in the pyramid.

<result>40</result>