import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {
	public static final int BIG_NUM = 2000000000;
	public static final int MOD = 1000000007;

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		final int size = 105;
		
		Stack stack = new Stack(size);
		int a,b;
		
		try {
			String input_str[] = br.readLine().split("\\s+");
			for(int i=0; i<input_str.length; i++) {
				switch(input_str[i]) {
				case "+":
					
					a = stack.pop();
					b = stack.pop();
					stack.push(a+b);
					break;
				
				case "-":
					b = stack.pop();
					a = stack.pop();
					stack.push(a-b);
					break;
					
				case "*":
					a = stack.pop();
					b = stack.pop();
					stack.push(a*b);
					break;
					
				default:
					stack.push(Integer.parseInt(input_str[i]));
					break;
				}
			}
			System.out.println(stack.pop());
		} catch (NumberFormatException | IOException e) {
			e.printStackTrace();
		}
	}
}

class Stack {
	private int num[];
	private int top;
	
	Stack(int arg_size){
		num = new int[arg_size];
		top = 0;
	}
	
	public void push(int x) {
		num[top++] = x;
	}
	
	public int pop() {
		top--;
		return num[top];
	}
	
	public boolean isEmpty() {
		return top == 0;
	}
}
 import java.io.BufferedReader; BufferedReader java.io import java.io.IOException; IOException java.io import java.io.InputStreamReader; InputStreamReader java.io public class Main {
	public static final int BIG_NUM = 2000000000;
	public static final int MOD = 1000000007;

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		final int size = 105;
		
		Stack stack = new Stack(size);
		int a,b;
		
		try {
			String input_str[] = br.readLine().split("\\s+");
			for(int i=0; i<input_str.length; i++) {
				switch(input_str[i]) {
				case "+":
					
					a = stack.pop();
					b = stack.pop();
					stack.push(a+b);
					break;
				
				case "-":
					b = stack.pop();
					a = stack.pop();
					stack.push(a-b);
					break;
					
				case "*":
					a = stack.pop();
					b = stack.pop();
					stack.push(a*b);
					break;
					
				default:
					stack.push(Integer.parseInt(input_str[i]));
					break;
				}
			}
			System.out.println(stack.pop());
		} catch (NumberFormatException | IOException e) {
			e.printStackTrace();
		}
	}
} Main public static final int BIG_NUM = 2000000000; BIG_NUM 2000000000 public static final int MOD = 1000000007; MOD 1000000007 public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		final int size = 105;
		
		Stack stack = new Stack(size);
		int a,b;
		
		try {
			String input_str[] = br.readLine().split("\\s+");
			for(int i=0; i<input_str.length; i++) {
				switch(input_str[i]) {
				case "+":
					
					a = stack.pop();
					b = stack.pop();
					stack.push(a+b);
					break;
				
				case "-":
					b = stack.pop();
					a = stack.pop();
					stack.push(a-b);
					break;
					
				case "*":
					a = stack.pop();
					b = stack.pop();
					stack.push(a*b);
					break;
					
				default:
					stack.push(Integer.parseInt(input_str[i]));
					break;
				}
			}
			System.out.println(stack.pop());
		} catch (NumberFormatException | IOException e) {
			e.printStackTrace();
		}
	} main {
		// TODO 自動生成されたメソッド・スタブ
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		final int size = 105;
		
		Stack stack = new Stack(size);
		int a,b;
		
		try {
			String input_str[] = br.readLine().split("\\s+");
			for(int i=0; i<input_str.length; i++) {
				switch(input_str[i]) {
				case "+":
					
					a = stack.pop();
					b = stack.pop();
					stack.push(a+b);
					break;
				
				case "-":
					b = stack.pop();
					a = stack.pop();
					stack.push(a-b);
					break;
					
				case "*":
					a = stack.pop();
					b = stack.pop();
					stack.push(a*b);
					break;
					
				default:
					stack.push(Integer.parseInt(input_str[i]));
					break;
				}
			}
			System.out.println(stack.pop());
		} catch (NumberFormatException | IOException e) {
			e.printStackTrace();
		}
	} BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); br new BufferedReader(new InputStreamReader(System.in)) final int size = 105; size 105 Stack stack = new Stack(size); stack new Stack(size) int a a b; b try {
			String input_str[] = br.readLine().split("\\s+");
			for(int i=0; i<input_str.length; i++) {
				switch(input_str[i]) {
				case "+":
					
					a = stack.pop();
					b = stack.pop();
					stack.push(a+b);
					break;
				
				case "-":
					b = stack.pop();
					a = stack.pop();
					stack.push(a-b);
					break;
					
				case "*":
					a = stack.pop();
					b = stack.pop();
					stack.push(a*b);
					break;
					
				default:
					stack.push(Integer.parseInt(input_str[i]));
					break;
				}
			}
			System.out.println(stack.pop());
		} catch (NumberFormatException | IOException e) {
			e.printStackTrace();
		} catch (NumberFormatException | IOException e) {
			e.printStackTrace();
		} NumberFormatException | IOException e {
			e.printStackTrace();
		} e.printStackTrace() e.printStackTrace e {
			String input_str[] = br.readLine().split("\\s+");
			for(int i=0; i<input_str.length; i++) {
				switch(input_str[i]) {
				case "+":
					
					a = stack.pop();
					b = stack.pop();
					stack.push(a+b);
					break;
				
				case "-":
					b = stack.pop();
					a = stack.pop();
					stack.push(a-b);
					break;
					
				case "*":
					a = stack.pop();
					b = stack.pop();
					stack.push(a*b);
					break;
					
				default:
					stack.push(Integer.parseInt(input_str[i]));
					break;
				}
			}
			System.out.println(stack.pop());
		} String input_str[] = br.readLine().split("\\s+"); input_str br.readLine().split("\\s+") br.readLine().split br.readLine() br.readLine br "\\s+" for(int i=0; i<input_str.length; i++) {
				switch(input_str[i]) {
				case "+":
					
					a = stack.pop();
					b = stack.pop();
					stack.push(a+b);
					break;
				
				case "-":
					b = stack.pop();
					a = stack.pop();
					stack.push(a-b);
					break;
					
				case "*":
					a = stack.pop();
					b = stack.pop();
					stack.push(a*b);
					break;
					
				default:
					stack.push(Integer.parseInt(input_str[i]));
					break;
				}
			} int i=0; int i=0; i 0 i<input_str.length i input_str.length input_str input_str.length i++ i++ i {
				switch(input_str[i]) {
				case "+":
					
					a = stack.pop();
					b = stack.pop();
					stack.push(a+b);
					break;
				
				case "-":
					b = stack.pop();
					a = stack.pop();
					stack.push(a-b);
					break;
					
				case "*":
					a = stack.pop();
					b = stack.pop();
					stack.push(a*b);
					break;
					
				default:
					stack.push(Integer.parseInt(input_str[i]));
					break;
				}
			} {
				switch(input_str[i]) {
				case "+":
					
					a = stack.pop();
					b = stack.pop();
					stack.push(a+b);
					break;
				
				case "-":
					b = stack.pop();
					a = stack.pop();
					stack.push(a-b);
					break;
					
				case "*":
					a = stack.pop();
					b = stack.pop();
					stack.push(a*b);
					break;
					
				default:
					stack.push(Integer.parseInt(input_str[i]));
					break;
				}
			} switch(input_str[i]) {
				case "+":
					
					a = stack.pop();
					b = stack.pop();
					stack.push(a+b);
					break;
				
				case "-":
					b = stack.pop();
					a = stack.pop();
					stack.push(a-b);
					break;
					
				case "*":
					a = stack.pop();
					b = stack.pop();
					stack.push(a*b);
					break;
					
				default:
					stack.push(Integer.parseInt(input_str[i]));
					break;
				} input_str[i] input_str i case "+": "+" case "+": a = stack.pop() a stack.pop() stack.pop stack b = stack.pop() b stack.pop() stack.pop stack stack.push(a+b) stack.push stack a+b a b break; case "-": "-" case "-": b = stack.pop() b stack.pop() stack.pop stack a = stack.pop() a stack.pop() stack.pop stack stack.push(a-b) stack.push stack a-b a b break; case "*": "*" case "*": a = stack.pop() a stack.pop() stack.pop stack b = stack.pop() b stack.pop() stack.pop stack stack.push(a*b) stack.push stack a*b a b break; default: default: stack.push(Integer.parseInt(input_str[i])) stack.push stack Integer.parseInt(input_str[i]) Integer.parseInt Integer input_str[i] input_str i break; System.out.println(stack.pop()) System.out.println System.out System System.out stack.pop() stack.pop stack String[] args args class Stack {
	private int num[];
	private int top;
	
	Stack(int arg_size){
		num = new int[arg_size];
		top = 0;
	}
	
	public void push(int x) {
		num[top++] = x;
	}
	
	public int pop() {
		top--;
		return num[top];
	}
	
	public boolean isEmpty() {
		return top == 0;
	}
} Stack private int num[]; num private int top; top Stack(int arg_size){
		num = new int[arg_size];
		top = 0;
	} Stack {
		num = new int[arg_size];
		top = 0;
	} num = new int[arg_size] num new int[arg_size] arg_size top = 0 top 0 int arg_size arg_size public void push(int x) {
		num[top++] = x;
	} push {
		num[top++] = x;
	} num[top++] = x num[top++] num top++ top x int x x public int pop() {
		top--;
		return num[top];
	} pop {
		top--;
		return num[top];
	} top-- top return num[top]; num[top] num top public boolean isEmpty() {
		return top == 0;
	} isEmpty {
		return top == 0;
	} return top == 0; top == 0 top 0 public class Main {
	public static final int BIG_NUM = 2000000000;
	public static final int MOD = 1000000007;

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		final int size = 105;
		
		Stack stack = new Stack(size);
		int a,b;
		
		try {
			String input_str[] = br.readLine().split("\\s+");
			for(int i=0; i<input_str.length; i++) {
				switch(input_str[i]) {
				case "+":
					
					a = stack.pop();
					b = stack.pop();
					stack.push(a+b);
					break;
				
				case "-":
					b = stack.pop();
					a = stack.pop();
					stack.push(a-b);
					break;
					
				case "*":
					a = stack.pop();
					b = stack.pop();
					stack.push(a*b);
					break;
					
				default:
					stack.push(Integer.parseInt(input_str[i]));
					break;
				}
			}
			System.out.println(stack.pop());
		} catch (NumberFormatException | IOException e) {
			e.printStackTrace();
		}
	}
} public class Main {
	public static final int BIG_NUM = 2000000000;
	public static final int MOD = 1000000007;

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		final int size = 105;
		
		Stack stack = new Stack(size);
		int a,b;
		
		try {
			String input_str[] = br.readLine().split("\\s+");
			for(int i=0; i<input_str.length; i++) {
				switch(input_str[i]) {
				case "+":
					
					a = stack.pop();
					b = stack.pop();
					stack.push(a+b);
					break;
				
				case "-":
					b = stack.pop();
					a = stack.pop();
					stack.push(a-b);
					break;
					
				case "*":
					a = stack.pop();
					b = stack.pop();
					stack.push(a*b);
					break;
					
				default:
					stack.push(Integer.parseInt(input_str[i]));
					break;
				}
			}
			System.out.println(stack.pop());
		} catch (NumberFormatException | IOException e) {
			e.printStackTrace();
		}
	}
} Main
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {
	public static final int BIG_NUM = 2000000000;
	public static final int MOD = 1000000007;

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		final int size = 105;
		
		Stack stack = new Stack(size);
		int a,b;
		
		try {
			String input_str[] = br.readLine().split("\\s+");
			for(int i=0; i<input_str.length; i++) {
				switch(input_str[i]) {
				case "+":
					
					a = stack.pop();
					b = stack.pop();
					stack.push(a+b);
					break;
				
				case "-":
					b = stack.pop();
					a = stack.pop();
					stack.push(a-b);
					break;
					
				case "*":
					a = stack.pop();
					b = stack.pop();
					stack.push(a*b);
					break;
					
				default:
					stack.push(Integer.parseInt(input_str[i]));
					break;
				}
			}
			System.out.println(stack.pop());
		} catch (NumberFormatException | IOException e) {
			e.printStackTrace();
		}
	}
}

class Stack {
	private int num[];
	private int top;
	
	Stack(int arg_size){
		num = new int[arg_size];
		top = 0;
	}
	
	public void push(int x) {
		num[top++] = x;
	}
	
	public int pop() {
		top--;
		return num[top];
	}
	
	public boolean isEmpty() {
		return top == 0;
	}
}

