Xiao Ming bought some pencils when he started school, and he used half of the total number of pencils in the first month, more than 2, and used the remaining half and more than 1 pencil in the second month. At this time, Xiao Ming still had 3 pencils left. How many pencils did Xiao Ming buy in total?
小明开学时买了一些铅笔，他第一个月用了总数的一半多2支，第二个月用了余下的一半多1支，这时小明还剩下3支．小明一共买了多少支铅笔？
<gadget id="calculator">3 + 1</gadget>
<output>4</output>

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

<gadget id="calculator">8 + 2</gadget>
<output>10</output>

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

<result>20</result>