There are more than 5,000 toothpicks, which can be divided into small packages according to six specifications. If there are 10 sticks in a pack, then there are 9 sticks left in the end. If there are 9 sticks in a pack, then there are 8 sticks left in the end. The third, fourth, fifth, and sixth specifications are 8, 7, 6, and 5 sticks in a pack, so there are 7, 6, 5, and 4 sticks left in the end. How many toothpicks are there in total?
有5000多根牙签，可按六种规格分成小包．如果10根一包，那么最后还剩9根．如果9根一包，那么最后还剩8根．第三、四、五、六种的规格是，分别以8、7、6、5根为一包，那么最后也分别剩7、6、5、4根．原来一共有牙签多少根．
<gadget id="calculator">5 * 2 * 3 * 3 * 4 * 7</gadget>
<output>2_520</output>

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

<gadget id="calculator">5_040 - 1</gadget>
<output>5_039</output>

<result>5_039</result>