There are more than 5,000 toothpicks, which are divided into small packages according to the following 6 specifications: if there are 10 toothpicks in a pack, there will be 9 sticks left in the end; if there are 9 toothpicks in a pack, there will be 8 sticks left in the end; In one pack, there are 7, 6, 5, and 4 sticks left in the end. How many toothpicks are there in total?
有5000多根牙签，按以下6种规格分成小包：如果10根一包，最后还剩9根；如果9根一包，最后还剩8根；如果依次以8、7、6、5根为一包，最后分别剩7、6、5、4根．原来一共有牙签多少根？
<gadget id="calculator">2 * 4 * 7 * 3 * 5</gadget>
<output>840</output>

<gadget id="calculator">840 * 6</gadget>
<output>5_040</output>

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

<result>5_039</result>