Greg and Sarah have 18 apples that they are going to split evenly. Susan has twice as many apples as Greg will end up with. Mark has 5 fewer apples than Susan. Their mom needs 40 apples to make an apple pie. How many will she have left over? Let's think step by step and output the final answer after "####".
user
Greg and Sarah will split their apples, so 18 apples / 2 = <<18/2=9>>9 apples per child.
Susan has 2 * 9 apples = <<2*9=18>>18 apples.
Mark has 18 apples - 5 apples = <<18-5=13>>13 apples.
Combined the children have 9 apples + 9 apples + 18 apples + 13 apples = <<9+9+18+13=49>>49 apples.
Mom will have 49 apples - 40 apples = <<49-40=9>>9 apples left over.
#### 9
Greg and Sarah have 18 apples that they are going to split evenly. Susan has twice as many apples as Greg will end up with. Mark has 5 fewer apples than Susan. Their mom needs 40 apples to make an apple pie. How many will she have left over?
train