There are several small balls in the bag. Xiao Ming takes out half of them each time and puts one back in. This is done 3 times, and there are still 6 balls left in the bag. How many balls were there in the original bag?
袋子中有若干个小球，小明每次从中拿出一半，再放回1个，这样进行了3次，袋子中还余下6个球．原来袋子中共有多少个小球？
<gadget id="calculator">6 - 1</gadget>
<output>5</output>

<gadget id="calculator">2 * 5</gadget>
<output>10</output>

<gadget id="calculator">10 - 1</gadget>
<output>9</output>

<gadget id="calculator">2 * 9</gadget>
<output>18</output>

<gadget id="calculator">18 - 1</gadget>
<output>17</output>

<gadget id="calculator">2 * 17</gadget>
<output>34</output>

<result>34</result>