Mathematical splicing chocolate
At the beginning, the box was 500 grams, and after eating it was 340 grams, which means that you ate 160 grams, and this 160 grams is 40% of all chocolates, so all chocolates are 160÷40%, which means that the formula you gave is 500-340 ÷. You got it?