Once you get your total, what do you do with the result?
You need to put the result in some storage and have your application look for it if it does not have enough input elements (i.e., you didn't start with a new a+b)
something like this
(pseudocode) for addtion:
if(b is undefined) b = c;
c = a + b;
write c;
Now the above doesn't work (as written) for the first input - it's only an example showing you that if you wish to add a second number to the result AFTER an operation you need to have some way to recall and use the old answer for the new operation.