Brian and Katie have $40 to spend at the store. If they get 4 bags of pasta which cost $1 each, 2 cans of tomatoes which cost $2 each, a $3 gallon of milk, and 3 loaves of bread which cost $3 each, how much change will James and Kelly receive after their purchase?