| Online MIPT programming contest | РУССКИЙ |
| <PREV Problem: | NEXT> |
< |
|---|
Time limit = 5 second(s)
Memory limit = 33000 Kb
You are the main programmer of Walfram Research Corp.You should wrigh program Arithmetica v1.0, that works as calculator.
Arithmetica v1.0 calculates arithmetic expressions
over integer numbers (not very long)
constructed from brackets ( )
and binary operators + *.
Unary minus is also allowed.
Operators have equal priority and should be calculated from left to right. It means that 1+1*2=4.
The number of symbols in input expression less than 1000.
Input One line with correct arithmetic expression less than 1000 symbols. Consider all numbers emerging during calculation of the expression small in absolute value, less than 230. Arithmetics of long integers will be realised in future versions.
Output One integer number result of calculations.
Input#11+1 |
Output#12 |
Input#2-1+(2*3) |
Output#25 |
Input#31+(1+(1+(1-1)*2)*2)*2 |
Output#314 |
Input#4(((-1))) |
Output#4-1 |
Input#5-1000*1000 |
Output#5-1000000 |
Author:
Voroztsov Artem
26 March 2003
© acm.mipt DevGroup The page was generated in 380ms |