There are several balls in the bag. Xiao Ming takes out half of them each time and puts back a ball. He does this five times in total. There are still 3 balls in the bag. How many balls are there in the bag?
袋子里有若干个球，小明每次拿出其中的一半再放回一个球，一共这样做了五次，袋中还有3个球，问原来袋中有多少个球？
<gadget id="calculator">3 - 1</gadget>
<output>2</output>

<gadget id="calculator">2 * 2</gadget>
<output>4</output>

<gadget id="calculator">4 - 1</gadget>
<output>3</output>

<gadget id="calculator">2 * 3</gadget>
<output>6</output>

<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>