1986 ACM East Central Regional Programming Contest

Problem #2: An Extended-Precison Calculator

For this problem you are to write a program to implement an extended- precision calculator - one that performs addition, subtraction and multiplication on numbers of somewhat arbitrary length.

The input is a sequence of expressions, one per line. Each expression is composed of one or more numbers (decimal integers) separated by one of the binary operators '+', '-' or '*' (corresponding, respectively, to the operations above). All three operators have equal precedence and associate to the left. Blanks may appear anywhere except within a number.

Your program should read each input line, perform the indicated operation(s), and print the result. The output should start in column one and have no leading zero's. For example,

	7 -   3*4+  6
means
	((7-3)*4+6) = (4*4)+6 = 16+6 = 22

You may assume that neither the answer, nor any input values, nor any intermediate results will be negative. The input lines will be no longer than 74 characters and neither numbers nor intermediate results will be longer than 40 digits.

Sample Input

7 -  3*4 + 6
    22 + 28 +10   *8 -80*2
	95738253857459621 +1478885269 *626262825 -  4587302
	 43

Sample Output

22
800
59957310247510675981126948
43