import java.io.*;

class Stack{
	private int[] StackArray;
	private final int maxSize = 100;
	private int top;
	
	public Stack(){
		StackArray = new int[maxSize];
		top = -1;
	}
	public int pop(){
		return StackArray[top--];
	}
	public void push(int o){
		StackArray[++top] = o;
	}
	public int peak(){
		return StackArray[top];
	}
}

public class Main {
	public static void main(String[] args)throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String[] op = br.readLine().split(" ");
		Stack st = new Stack();
		
		for(int i = 0;i<op.length;i++){
			char ch = op[i].charAt(0);
			int a,b;
			switch(ch){
				case '+':
					a = st.pop();
					b = st.pop();
					st.push(b+a);
					break;
				case '-':
					a = st.pop();
					b = st.pop();
					st.push(b-a);
					break;
				case '*':
					a = st.pop();
					b = st.pop();
					st.push(b*a);
					break;
				case '/':
					a = st.pop();
					b = st.pop();
					st.push(b/a);
					break;
				default:
					st.push(Integer.parseInt(""+op[i]));
					break;
			}
		}
		System.out.println(st.peak());
	}
} import java.io.*; io.* java class Stack{
	private int[] StackArray;
	private final int maxSize = 100;
	private int top;
	
	public Stack(){
		StackArray = new int[maxSize];
		top = -1;
	}
	public int pop(){
		return StackArray[top--];
	}
	public void push(int o){
		StackArray[++top] = o;
	}
	public int peak(){
		return StackArray[top];
	}
} Stack private int[] StackArray; StackArray private final int maxSize = 100; maxSize 100 private int top; top public Stack(){
		StackArray = new int[maxSize];
		top = -1;
	} Stack {
		StackArray = new int[maxSize];
		top = -1;
	} StackArray = new int[maxSize] StackArray new int[maxSize] maxSize top = -1 top -1 1 public int pop(){
		return StackArray[top--];
	} pop {
		return StackArray[top--];
	} return StackArray[top--]; StackArray[top--] StackArray top-- top public void push(int o){
		StackArray[++top] = o;
	} push {
		StackArray[++top] = o;
	} StackArray[++top] = o StackArray[++top] StackArray ++top top o int o o public int peak(){
		return StackArray[top];
	} peak {
		return StackArray[top];
	} return StackArray[top]; StackArray[top] StackArray top public class Main {
	public static void main(String[] args)throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String[] op = br.readLine().split(" ");
		Stack st = new Stack();
		
		for(int i = 0;i<op.length;i++){
			char ch = op[i].charAt(0);
			int a,b;
			switch(ch){
				case '+':
					a = st.pop();
					b = st.pop();
					st.push(b+a);
					break;
				case '-':
					a = st.pop();
					b = st.pop();
					st.push(b-a);
					break;
				case '*':
					a = st.pop();
					b = st.pop();
					st.push(b*a);
					break;
				case '/':
					a = st.pop();
					b = st.pop();
					st.push(b/a);
					break;
				default:
					st.push(Integer.parseInt(""+op[i]));
					break;
			}
		}
		System.out.println(st.peak());
	}
} Main public static void main(String[] args)throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String[] op = br.readLine().split(" ");
		Stack st = new Stack();
		
		for(int i = 0;i<op.length;i++){
			char ch = op[i].charAt(0);
			int a,b;
			switch(ch){
				case '+':
					a = st.pop();
					b = st.pop();
					st.push(b+a);
					break;
				case '-':
					a = st.pop();
					b = st.pop();
					st.push(b-a);
					break;
				case '*':
					a = st.pop();
					b = st.pop();
					st.push(b*a);
					break;
				case '/':
					a = st.pop();
					b = st.pop();
					st.push(b/a);
					break;
				default:
					st.push(Integer.parseInt(""+op[i]));
					break;
			}
		}
		System.out.println(st.peak());
	} main {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String[] op = br.readLine().split(" ");
		Stack st = new Stack();
		
		for(int i = 0;i<op.length;i++){
			char ch = op[i].charAt(0);
			int a,b;
			switch(ch){
				case '+':
					a = st.pop();
					b = st.pop();
					st.push(b+a);
					break;
				case '-':
					a = st.pop();
					b = st.pop();
					st.push(b-a);
					break;
				case '*':
					a = st.pop();
					b = st.pop();
					st.push(b*a);
					break;
				case '/':
					a = st.pop();
					b = st.pop();
					st.push(b/a);
					break;
				default:
					st.push(Integer.parseInt(""+op[i]));
					break;
			}
		}
		System.out.println(st.peak());
	} BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); br new BufferedReader(new InputStreamReader(System.in)) String[] op = br.readLine().split(" "); op br.readLine().split(" ") br.readLine().split br.readLine() br.readLine br " " Stack st = new Stack(); st new Stack() for(int i = 0;i<op.length;i++){
			char ch = op[i].charAt(0);
			int a,b;
			switch(ch){
				case '+':
					a = st.pop();
					b = st.pop();
					st.push(b+a);
					break;
				case '-':
					a = st.pop();
					b = st.pop();
					st.push(b-a);
					break;
				case '*':
					a = st.pop();
					b = st.pop();
					st.push(b*a);
					break;
				case '/':
					a = st.pop();
					b = st.pop();
					st.push(b/a);
					break;
				default:
					st.push(Integer.parseInt(""+op[i]));
					break;
			}
		} int i = 0; int i = 0; i 0 i<op.length i op.length op op.length i++ i++ i {
			char ch = op[i].charAt(0);
			int a,b;
			switch(ch){
				case '+':
					a = st.pop();
					b = st.pop();
					st.push(b+a);
					break;
				case '-':
					a = st.pop();
					b = st.pop();
					st.push(b-a);
					break;
				case '*':
					a = st.pop();
					b = st.pop();
					st.push(b*a);
					break;
				case '/':
					a = st.pop();
					b = st.pop();
					st.push(b/a);
					break;
				default:
					st.push(Integer.parseInt(""+op[i]));
					break;
			}
		} {
			char ch = op[i].charAt(0);
			int a,b;
			switch(ch){
				case '+':
					a = st.pop();
					b = st.pop();
					st.push(b+a);
					break;
				case '-':
					a = st.pop();
					b = st.pop();
					st.push(b-a);
					break;
				case '*':
					a = st.pop();
					b = st.pop();
					st.push(b*a);
					break;
				case '/':
					a = st.pop();
					b = st.pop();
					st.push(b/a);
					break;
				default:
					st.push(Integer.parseInt(""+op[i]));
					break;
			}
		} char ch = op[i].charAt(0); ch op[i].charAt(0) op[i].charAt op[i] op i 0 int a a b; b switch(ch){
				case '+':
					a = st.pop();
					b = st.pop();
					st.push(b+a);
					break;
				case '-':
					a = st.pop();
					b = st.pop();
					st.push(b-a);
					break;
				case '*':
					a = st.pop();
					b = st.pop();
					st.push(b*a);
					break;
				case '/':
					a = st.pop();
					b = st.pop();
					st.push(b/a);
					break;
				default:
					st.push(Integer.parseInt(""+op[i]));
					break;
			} ch case '+': '+' case '+': a = st.pop() a st.pop() st.pop st b = st.pop() b st.pop() st.pop st st.push(b+a) st.push st b+a b a break; case '-': '-' case '-': a = st.pop() a st.pop() st.pop st b = st.pop() b st.pop() st.pop st st.push(b-a) st.push st b-a b a break; case '*': '*' case '*': a = st.pop() a st.pop() st.pop st b = st.pop() b st.pop() st.pop st st.push(b*a) st.push st b*a b a break; case '/': '/' case '/': a = st.pop() a st.pop() st.pop st b = st.pop() b st.pop() st.pop st st.push(b/a) st.push st b/a b a break; default: default: st.push(Integer.parseInt(""+op[i])) st.push st Integer.parseInt(""+op[i]) Integer.parseInt Integer ""+op[i] "" op[i] op i break; System.out.println(st.peak()) System.out.println System.out System System.out st.peak() st.peak st String[] args args public class Main {
	public static void main(String[] args)throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String[] op = br.readLine().split(" ");
		Stack st = new Stack();
		
		for(int i = 0;i<op.length;i++){
			char ch = op[i].charAt(0);
			int a,b;
			switch(ch){
				case '+':
					a = st.pop();
					b = st.pop();
					st.push(b+a);
					break;
				case '-':
					a = st.pop();
					b = st.pop();
					st.push(b-a);
					break;
				case '*':
					a = st.pop();
					b = st.pop();
					st.push(b*a);
					break;
				case '/':
					a = st.pop();
					b = st.pop();
					st.push(b/a);
					break;
				default:
					st.push(Integer.parseInt(""+op[i]));
					break;
			}
		}
		System.out.println(st.peak());
	}
} public class Main {
	public static void main(String[] args)throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String[] op = br.readLine().split(" ");
		Stack st = new Stack();
		
		for(int i = 0;i<op.length;i++){
			char ch = op[i].charAt(0);
			int a,b;
			switch(ch){
				case '+':
					a = st.pop();
					b = st.pop();
					st.push(b+a);
					break;
				case '-':
					a = st.pop();
					b = st.pop();
					st.push(b-a);
					break;
				case '*':
					a = st.pop();
					b = st.pop();
					st.push(b*a);
					break;
				case '/':
					a = st.pop();
					b = st.pop();
					st.push(b/a);
					break;
				default:
					st.push(Integer.parseInt(""+op[i]));
					break;
			}
		}
		System.out.println(st.peak());
	}
} Main
import java.io.*;

class Stack{
	private int[] StackArray;
	private final int maxSize = 100;
	private int top;
	
	public Stack(){
		StackArray = new int[maxSize];
		top = -1;
	}
	public int pop(){
		return StackArray[top--];
	}
	public void push(int o){
		StackArray[++top] = o;
	}
	public int peak(){
		return StackArray[top];
	}
}

public class Main {
	public static void main(String[] args)throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String[] op = br.readLine().split(" ");
		Stack st = new Stack();
		
		for(int i = 0;i<op.length;i++){
			char ch = op[i].charAt(0);
			int a,b;
			switch(ch){
				case '+':
					a = st.pop();
					b = st.pop();
					st.push(b+a);
					break;
				case '-':
					a = st.pop();
					b = st.pop();
					st.push(b-a);
					break;
				case '*':
					a = st.pop();
					b = st.pop();
					st.push(b*a);
					break;
				case '/':
					a = st.pop();
					b = st.pop();
					st.push(b/a);
					break;
				default:
					st.push(Integer.parseInt(""+op[i]));
					break;
			}
		}
		System.out.println(st.peak());
	}
}