import java.util.Scanner;

class Stack {
	private int top;
	private int[] a;
	
	Stack(){
		this.top=0;
		this.a=new int[200];
	}
	
	void push(int x){
		a[top++]=x;
	}
	
	int pop(){
		top--;
		return a[top];
	}
	
}

class Main {
	public static void main(String[] args){
		Scanner scan=new Scanner(System.in);
		Stack S=new Stack();
		
		while(scan.hasNext()){
			String str=scan.next();
			if(Character.isDigit(str.charAt(0))){
				S.push(Integer.parseInt(str));
			}
			else {
				int a=S.pop(); int b=S.pop();
				switch(str.charAt(0)){
					case '+':S.push(b+a);
							 break;
					case '-':S.push(b-a);
							 break;
					case '*':S.push(b*a);
							 break;
				}
			}
		}
		System.out.println(S.pop());
	}
} import java.util.Scanner; Scanner java.util class Stack {
	private int top;
	private int[] a;
	
	Stack(){
		this.top=0;
		this.a=new int[200];
	}
	
	void push(int x){
		a[top++]=x;
	}
	
	int pop(){
		top--;
		return a[top];
	}
	
} Stack private int top; top private int[] a; a Stack(){
		this.top=0;
		this.a=new int[200];
	} Stack {
		this.top=0;
		this.a=new int[200];
	} this.top=0 this.top this this.top 0 this.a=new int[200] this.a this this.a new int[200] 200 void push(int x){
		a[top++]=x;
	} push {
		a[top++]=x;
	} a[top++]=x a[top++] a top++ top x int x x int pop(){
		top--;
		return a[top];
	} pop {
		top--;
		return a[top];
	} top-- top return a[top]; a[top] a top class Main {
	public static void main(String[] args){
		Scanner scan=new Scanner(System.in);
		Stack S=new Stack();
		
		while(scan.hasNext()){
			String str=scan.next();
			if(Character.isDigit(str.charAt(0))){
				S.push(Integer.parseInt(str));
			}
			else {
				int a=S.pop(); int b=S.pop();
				switch(str.charAt(0)){
					case '+':S.push(b+a);
							 break;
					case '-':S.push(b-a);
							 break;
					case '*':S.push(b*a);
							 break;
				}
			}
		}
		System.out.println(S.pop());
	}
} Main public static void main(String[] args){
		Scanner scan=new Scanner(System.in);
		Stack S=new Stack();
		
		while(scan.hasNext()){
			String str=scan.next();
			if(Character.isDigit(str.charAt(0))){
				S.push(Integer.parseInt(str));
			}
			else {
				int a=S.pop(); int b=S.pop();
				switch(str.charAt(0)){
					case '+':S.push(b+a);
							 break;
					case '-':S.push(b-a);
							 break;
					case '*':S.push(b*a);
							 break;
				}
			}
		}
		System.out.println(S.pop());
	} main {
		Scanner scan=new Scanner(System.in);
		Stack S=new Stack();
		
		while(scan.hasNext()){
			String str=scan.next();
			if(Character.isDigit(str.charAt(0))){
				S.push(Integer.parseInt(str));
			}
			else {
				int a=S.pop(); int b=S.pop();
				switch(str.charAt(0)){
					case '+':S.push(b+a);
							 break;
					case '-':S.push(b-a);
							 break;
					case '*':S.push(b*a);
							 break;
				}
			}
		}
		System.out.println(S.pop());
	} Scanner scan=new Scanner(System.in); scan new Scanner(System.in) Stack S=new Stack(); S new Stack() while(scan.hasNext()){
			String str=scan.next();
			if(Character.isDigit(str.charAt(0))){
				S.push(Integer.parseInt(str));
			}
			else {
				int a=S.pop(); int b=S.pop();
				switch(str.charAt(0)){
					case '+':S.push(b+a);
							 break;
					case '-':S.push(b-a);
							 break;
					case '*':S.push(b*a);
							 break;
				}
			}
		} scan.hasNext() scan.hasNext scan {
			String str=scan.next();
			if(Character.isDigit(str.charAt(0))){
				S.push(Integer.parseInt(str));
			}
			else {
				int a=S.pop(); int b=S.pop();
				switch(str.charAt(0)){
					case '+':S.push(b+a);
							 break;
					case '-':S.push(b-a);
							 break;
					case '*':S.push(b*a);
							 break;
				}
			}
		} String str=scan.next(); str scan.next() scan.next scan if(Character.isDigit(str.charAt(0))){
				S.push(Integer.parseInt(str));
			}
			else {
				int a=S.pop(); int b=S.pop();
				switch(str.charAt(0)){
					case '+':S.push(b+a);
							 break;
					case '-':S.push(b-a);
							 break;
					case '*':S.push(b*a);
							 break;
				}
			} Character.isDigit(str.charAt(0)) Character.isDigit Character str.charAt(0) str.charAt str 0 {
				S.push(Integer.parseInt(str));
			} S.push(Integer.parseInt(str)) S.push S Integer.parseInt(str) Integer.parseInt Integer str {
				int a=S.pop(); int b=S.pop();
				switch(str.charAt(0)){
					case '+':S.push(b+a);
							 break;
					case '-':S.push(b-a);
							 break;
					case '*':S.push(b*a);
							 break;
				}
			} int a=S.pop(); a S.pop() S.pop S int b=S.pop(); b S.pop() S.pop S switch(str.charAt(0)){
					case '+':S.push(b+a);
							 break;
					case '-':S.push(b-a);
							 break;
					case '*':S.push(b*a);
							 break;
				} str.charAt(0) str.charAt str 0 case '+': '+' case '+': S.push(b+a) S.push S b+a b a break; case '-': '-' case '-': S.push(b-a) S.push S b-a b a break; case '*': '*' case '*': S.push(b*a) S.push S b*a b a break; System.out.println(S.pop()) System.out.println System.out System System.out S.pop() S.pop S String[] args args
import java.util.Scanner;

class Stack {
	private int top;
	private int[] a;
	
	Stack(){
		this.top=0;
		this.a=new int[200];
	}
	
	void push(int x){
		a[top++]=x;
	}
	
	int pop(){
		top--;
		return a[top];
	}
	
}

class Main {
	public static void main(String[] args){
		Scanner scan=new Scanner(System.in);
		Stack S=new Stack();
		
		while(scan.hasNext()){
			String str=scan.next();
			if(Character.isDigit(str.charAt(0))){
				S.push(Integer.parseInt(str));
			}
			else {
				int a=S.pop(); int b=S.pop();
				switch(str.charAt(0)){
					case '+':S.push(b+a);
							 break;
					case '-':S.push(b-a);
							 break;
					case '*':S.push(b*a);
							 break;
				}
			}
		}
		System.out.println(S.pop());
	}
}
