There is a calculator that takes n numbers. It calculates and shows the output, i.e. the sum of those numbers. But due to a defect, if one number is 0 then that number and the previous number gets deleted. If there is no number before the one that is 0, calculator does nothing.
You have to output the sum same as this calculator.
Input Constraints:
First line will contain integer - n. The next n lines will contain the respective numbers entered.
Output Constraints:
Print the required sum.
None