P27775 [洛谷] [NOIP2013 Junior Group] Expression Evaluation
普及
题目描述

Problem Background

NOIP2013 Junior Group T2

Problem Description

Given an arithmetic expression that only contains addition and multiplication, please write a program to compute the value of the expression.

Input Format

A single line containing the expression you need to compute. The expression only includes digits, addition operator +, and multiplication operator *. There are no parentheses, and all numbers involved in the operations are integers between $0$ and $2^{31}-1$.

The input data guarantees that this line only contains the $12$ characters 0123456789+*.

Output Format

An integer representing the value of the expression.

Note: When the length of the answer exceeds $4$ digits, please output only the last $4$ digits, without leading zeros.

Sample Input and Output

Sample Input #1

1+1*3+4

Sample Output #1

8

Sample Input #2

1+1234567890*1

Sample Output #2

7891

Sample Input #3

1+1000000003*1

Sample Output #3

4

Notes

For $30\%$ of the data, $0 \leq$ the total number of addition and multiplication operators in the expression $\leq 100$.

For $80\%$ of the data, $0 \leq$ the total number of addition and multiplication operators in the expression $\leq 1000$.

For $100\%$ of the data, $0 \leq$ the total number of addition and multiplication operators in the expression $\leq 100000$.

输入格式

见题面 Input 部分

输出格式

见题面 Output 部分

样例输入
1+1*3+4
样例输出
8