import java.util.Scanner;
public class Main {
	public static void main(String[] args){
		Scanner scan=new Scanner(System.in);
		int[] stack=new int[100];
		int stackPointer=0;
		String s;
		while(scan.hasNext()){
			s=scan.next();
			if(s.equals("+")){
				stack[stackPointer-2]=stack[stackPointer-2]+stack[stackPointer-1];
				stackPointer-=1;
			}else if(s.equals("-")){
				stack[stackPointer-2]=stack[stackPointer-2]-stack[stackPointer-1];
				stackPointer-=1;
			}
			else if(s.equals("*")){
				stack[stackPointer-2]=stack[stackPointer-2]*stack[stackPointer-1];
				stackPointer-=1;
			}
			else{
				stack[stackPointer++]=Integer.parseInt(s);
			}
		}
		System.out.println(stack[0]);
		scan.close();
	}
} import java.util.Scanner; Scanner java.util public class Main {
	public static void main(String[] args){
		Scanner scan=new Scanner(System.in);
		int[] stack=new int[100];
		int stackPointer=0;
		String s;
		while(scan.hasNext()){
			s=scan.next();
			if(s.equals("+")){
				stack[stackPointer-2]=stack[stackPointer-2]+stack[stackPointer-1];
				stackPointer-=1;
			}else if(s.equals("-")){
				stack[stackPointer-2]=stack[stackPointer-2]-stack[stackPointer-1];
				stackPointer-=1;
			}
			else if(s.equals("*")){
				stack[stackPointer-2]=stack[stackPointer-2]*stack[stackPointer-1];
				stackPointer-=1;
			}
			else{
				stack[stackPointer++]=Integer.parseInt(s);
			}
		}
		System.out.println(stack[0]);
		scan.close();
	}
} Main public static void main(String[] args){
		Scanner scan=new Scanner(System.in);
		int[] stack=new int[100];
		int stackPointer=0;
		String s;
		while(scan.hasNext()){
			s=scan.next();
			if(s.equals("+")){
				stack[stackPointer-2]=stack[stackPointer-2]+stack[stackPointer-1];
				stackPointer-=1;
			}else if(s.equals("-")){
				stack[stackPointer-2]=stack[stackPointer-2]-stack[stackPointer-1];
				stackPointer-=1;
			}
			else if(s.equals("*")){
				stack[stackPointer-2]=stack[stackPointer-2]*stack[stackPointer-1];
				stackPointer-=1;
			}
			else{
				stack[stackPointer++]=Integer.parseInt(s);
			}
		}
		System.out.println(stack[0]);
		scan.close();
	} main {
		Scanner scan=new Scanner(System.in);
		int[] stack=new int[100];
		int stackPointer=0;
		String s;
		while(scan.hasNext()){
			s=scan.next();
			if(s.equals("+")){
				stack[stackPointer-2]=stack[stackPointer-2]+stack[stackPointer-1];
				stackPointer-=1;
			}else if(s.equals("-")){
				stack[stackPointer-2]=stack[stackPointer-2]-stack[stackPointer-1];
				stackPointer-=1;
			}
			else if(s.equals("*")){
				stack[stackPointer-2]=stack[stackPointer-2]*stack[stackPointer-1];
				stackPointer-=1;
			}
			else{
				stack[stackPointer++]=Integer.parseInt(s);
			}
		}
		System.out.println(stack[0]);
		scan.close();
	} Scanner scan=new Scanner(System.in); scan new Scanner(System.in) int[] stack=new int[100]; stack new int[100] 100 int stackPointer=0; stackPointer 0 String s; s while(scan.hasNext()){
			s=scan.next();
			if(s.equals("+")){
				stack[stackPointer-2]=stack[stackPointer-2]+stack[stackPointer-1];
				stackPointer-=1;
			}else if(s.equals("-")){
				stack[stackPointer-2]=stack[stackPointer-2]-stack[stackPointer-1];
				stackPointer-=1;
			}
			else if(s.equals("*")){
				stack[stackPointer-2]=stack[stackPointer-2]*stack[stackPointer-1];
				stackPointer-=1;
			}
			else{
				stack[stackPointer++]=Integer.parseInt(s);
			}
		} scan.hasNext() scan.hasNext scan {
			s=scan.next();
			if(s.equals("+")){
				stack[stackPointer-2]=stack[stackPointer-2]+stack[stackPointer-1];
				stackPointer-=1;
			}else if(s.equals("-")){
				stack[stackPointer-2]=stack[stackPointer-2]-stack[stackPointer-1];
				stackPointer-=1;
			}
			else if(s.equals("*")){
				stack[stackPointer-2]=stack[stackPointer-2]*stack[stackPointer-1];
				stackPointer-=1;
			}
			else{
				stack[stackPointer++]=Integer.parseInt(s);
			}
		} s=scan.next() s scan.next() scan.next scan if(s.equals("+")){
				stack[stackPointer-2]=stack[stackPointer-2]+stack[stackPointer-1];
				stackPointer-=1;
			}else if(s.equals("-")){
				stack[stackPointer-2]=stack[stackPointer-2]-stack[stackPointer-1];
				stackPointer-=1;
			}
			else if(s.equals("*")){
				stack[stackPointer-2]=stack[stackPointer-2]*stack[stackPointer-1];
				stackPointer-=1;
			}
			else{
				stack[stackPointer++]=Integer.parseInt(s);
			} s.equals("+") s.equals s "+" {
				stack[stackPointer-2]=stack[stackPointer-2]+stack[stackPointer-1];
				stackPointer-=1;
			} stack[stackPointer-2]=stack[stackPointer-2]+stack[stackPointer-1] stack[stackPointer-2] stack stackPointer-2 stackPointer 2 stack[stackPointer-2]+stack[stackPointer-1] stack[stackPointer-2] stack stackPointer-2 stackPointer 2 stack[stackPointer-1] stack stackPointer-1 stackPointer 1 stackPointer-=1 stackPointer 1 if(s.equals("-")){
				stack[stackPointer-2]=stack[stackPointer-2]-stack[stackPointer-1];
				stackPointer-=1;
			}
			else if(s.equals("*")){
				stack[stackPointer-2]=stack[stackPointer-2]*stack[stackPointer-1];
				stackPointer-=1;
			}
			else{
				stack[stackPointer++]=Integer.parseInt(s);
			} s.equals("-") s.equals s "-" {
				stack[stackPointer-2]=stack[stackPointer-2]-stack[stackPointer-1];
				stackPointer-=1;
			} stack[stackPointer-2]=stack[stackPointer-2]-stack[stackPointer-1] stack[stackPointer-2] stack stackPointer-2 stackPointer 2 stack[stackPointer-2]-stack[stackPointer-1] stack[stackPointer-2] stack stackPointer-2 stackPointer 2 stack[stackPointer-1] stack stackPointer-1 stackPointer 1 stackPointer-=1 stackPointer 1 if(s.equals("*")){
				stack[stackPointer-2]=stack[stackPointer-2]*stack[stackPointer-1];
				stackPointer-=1;
			}
			else{
				stack[stackPointer++]=Integer.parseInt(s);
			} s.equals("*") s.equals s "*" {
				stack[stackPointer-2]=stack[stackPointer-2]*stack[stackPointer-1];
				stackPointer-=1;
			} stack[stackPointer-2]=stack[stackPointer-2]*stack[stackPointer-1] stack[stackPointer-2] stack stackPointer-2 stackPointer 2 stack[stackPointer-2]*stack[stackPointer-1] stack[stackPointer-2] stack stackPointer-2 stackPointer 2 stack[stackPointer-1] stack stackPointer-1 stackPointer 1 stackPointer-=1 stackPointer 1 {
				stack[stackPointer++]=Integer.parseInt(s);
			} stack[stackPointer++]=Integer.parseInt(s) stack[stackPointer++] stack stackPointer++ stackPointer Integer.parseInt(s) Integer.parseInt Integer s System.out.println(stack[0]) System.out.println System.out System System.out stack[0] stack 0 scan.close() scan.close scan String[] args args public class Main {
	public static void main(String[] args){
		Scanner scan=new Scanner(System.in);
		int[] stack=new int[100];
		int stackPointer=0;
		String s;
		while(scan.hasNext()){
			s=scan.next();
			if(s.equals("+")){
				stack[stackPointer-2]=stack[stackPointer-2]+stack[stackPointer-1];
				stackPointer-=1;
			}else if(s.equals("-")){
				stack[stackPointer-2]=stack[stackPointer-2]-stack[stackPointer-1];
				stackPointer-=1;
			}
			else if(s.equals("*")){
				stack[stackPointer-2]=stack[stackPointer-2]*stack[stackPointer-1];
				stackPointer-=1;
			}
			else{
				stack[stackPointer++]=Integer.parseInt(s);
			}
		}
		System.out.println(stack[0]);
		scan.close();
	}
} public class Main {
	public static void main(String[] args){
		Scanner scan=new Scanner(System.in);
		int[] stack=new int[100];
		int stackPointer=0;
		String s;
		while(scan.hasNext()){
			s=scan.next();
			if(s.equals("+")){
				stack[stackPointer-2]=stack[stackPointer-2]+stack[stackPointer-1];
				stackPointer-=1;
			}else if(s.equals("-")){
				stack[stackPointer-2]=stack[stackPointer-2]-stack[stackPointer-1];
				stackPointer-=1;
			}
			else if(s.equals("*")){
				stack[stackPointer-2]=stack[stackPointer-2]*stack[stackPointer-1];
				stackPointer-=1;
			}
			else{
				stack[stackPointer++]=Integer.parseInt(s);
			}
		}
		System.out.println(stack[0]);
		scan.close();
	}
} Main
import java.util.Scanner;
public class Main {
	public static void main(String[] args){
		Scanner scan=new Scanner(System.in);
		int[] stack=new int[100];
		int stackPointer=0;
		String s;
		while(scan.hasNext()){
			s=scan.next();
			if(s.equals("+")){
				stack[stackPointer-2]=stack[stackPointer-2]+stack[stackPointer-1];
				stackPointer-=1;
			}else if(s.equals("-")){
				stack[stackPointer-2]=stack[stackPointer-2]-stack[stackPointer-1];
				stackPointer-=1;
			}
			else if(s.equals("*")){
				stack[stackPointer-2]=stack[stackPointer-2]*stack[stackPointer-1];
				stackPointer-=1;
			}
			else{
				stack[stackPointer++]=Integer.parseInt(s);
			}
		}
		System.out.println(stack[0]);
		scan.close();
	}
}