For this case we have to:
x: Let the variable that represents the initial amount of jelly beans in the bag
So:
Maggie ate
of the jelly beans:
Then he ate 40 jelly beans:
In those two days he ate a total of 107 jelly beans:
We clear the value of the variable "x":
Answer:
The initial quantity of jelly beans was 335