Notes

Template in C

Constraints

2 ≤ the number of operands in the expression ≤ 100
1 ≤ the number of operators in the expression ≤ 99
-1 × 109 ≤ values in the stack ≤ 109

Input

An expression is given in a line. Two consequtive symbols (operand or operator) are separated by a space character.

You can assume that +, - and * are given as the operator and an operand is a positive integer less than 106

Output

Print the computational result in a line.

Examples

Input

1 2 +


Output

3


Input

1 2 + 3 4 - *


Output

-3
import java.util.Scanner;

public class Main {

	static int max = 250;
	static int s[] = new int[max + 1];
	static int top;

	static void initialize() {
		top = 0;
	}

	static boolean isEmpty() {
		return top == 0;
	}

	static boolean isFull() {
		return top >= max;
	}

	static void push(int x) {
		if(! isFull()){
			top++;
			s[top] = x;
		}
	}

	static int pop() {
		if(! isEmpty()) {
			top--;
			return s[top+1];
		}else {
			return -1;
		}
	}

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		initialize();
		String a = sc.nextLine();
		String[] tt = a.split(" ");
		for(int i=0;i<tt.length;i++){
			String t = tt[i];
			if(t.equals("+")) {
				int x = pop();
				int y = pop();
				push(x + y);
			}else if(t.equals("-")){
				int x = pop();
				int y = pop();
				push(y - x);
			}else if(t.equals("*")) {
				int x = pop();
				int y = pop();
				push(x*y);
			}else {
				int x = Integer.parseInt(t);
				push(x);
			}
		}
		System.out.println(pop());
	 }
}

