Quinton brought 40 cupcakes to school on his birthday. He gave a cupcake to each of the 18 students in Ms. Delmont's class. He also gave a cupcake to each of the 16 students in Mrs. Donnelly's class. He also gave a cupcake to Ms. Delmont, Mrs. Donnelly, the school nurse, and the school principal. How many cupcakes did he have left over? Let's think step by step and output the final answer after "####".
user
Quinton had 40 cupcakes - 18 = <<40-18=22>>22 cupcakes.
He then had 22 cupcakes - 16 students = <<22-16=6>>6 cupcakes.
Quinton then gave away 6 - 1 -1 -1 -1 = <<6-1-1-1-1=2>>2 cupcakes left.
#### 2
Quinton brought 40 cupcakes to school on his birthday. He gave a cupcake to each of the 18 students in Ms. Delmont's class. He also gave a cupcake to each of the 16 students in Mrs. Donnelly's class. He also gave a cupcake to Ms. Delmont, Mrs. Donnelly, the school nurse, and the school principal. How many cupcakes did he have left over?
train