import java.io.*;
import java.util.*;
public class Main{ 

	public static void main(String args[]){
		
		Scanner scan = new Scanner(System.in);
		RPN rpn = new RPN(scan.nextLine());
        rpn.analyze();

	}
}
class Stack{
    ArrayList<Integer> stk;
    public Stack(){
        stk = new ArrayList<Integer>();
    }
    public void push(int val){
        stk.add(val);
    }
    public int pop(){
        int tmp=stk.get(stk.size()-1);
        stk.remove(stk.size()-1);
        return tmp;
    }
    public int ans(){
        return stk.get(0);
    }
}
class RPN{
    String[] exp;
    Stack stack;
    public RPN(String e){
        exp = e.split(" ", 0);
        stack = new Stack();
    }

    public void analyze(){
        int num;
        for(String str : exp){
            if(str.equals("+") || str.equals("-") || str.equals("*") || str.equals("/"))
	            stack.push(calc(stack.pop(),stack.pop(),str.charAt(0)));
            else
                stack.push(Integer.parseInt(str));
        }
        System.out.println(stack.ans());
    }
    int calc(int b, int a, char op){
        if(op=='+')
            return a+b;
        if(op=='*')
            return a*b;
        if(op=='-')
            return a-b;
        System.out.println("error");
        return 0;
    }
}
  import java.io.*; io.* java import java.util.*; util.* java public class Main{ 

	public static void main(String args[]){
		
		Scanner scan = new Scanner(System.in);
		RPN rpn = new RPN(scan.nextLine());
        rpn.analyze();

	}
} Main public static void main(String args[]){
		
		Scanner scan = new Scanner(System.in);
		RPN rpn = new RPN(scan.nextLine());
        rpn.analyze();

	} main {
		
		Scanner scan = new Scanner(System.in);
		RPN rpn = new RPN(scan.nextLine());
        rpn.analyze();

	} Scanner scan = new Scanner(System.in); scan new Scanner(System.in) RPN rpn = new RPN(scan.nextLine()); rpn new RPN(scan.nextLine()) rpn.analyze() rpn.analyze rpn String args[] args class Stack{
    ArrayList<Integer> stk;
    public Stack(){
        stk = new ArrayList<Integer>();
    }
    public void push(int val){
        stk.add(val);
    }
    public int pop(){
        int tmp=stk.get(stk.size()-1);
        stk.remove(stk.size()-1);
        return tmp;
    }
    public int ans(){
        return stk.get(0);
    }
} Stack ArrayList<Integer> stk; stk public Stack(){
        stk = new ArrayList<Integer>();
    } Stack {
        stk = new ArrayList<Integer>();
    } stk = new ArrayList<Integer>() stk new ArrayList<Integer>() public void push(int val){
        stk.add(val);
    } push {
        stk.add(val);
    } stk.add(val) stk.add stk val int val val public int pop(){
        int tmp=stk.get(stk.size()-1);
        stk.remove(stk.size()-1);
        return tmp;
    } pop {
        int tmp=stk.get(stk.size()-1);
        stk.remove(stk.size()-1);
        return tmp;
    } int tmp=stk.get(stk.size()-1); tmp stk.get(stk.size()-1) stk.get stk stk.size()-1 stk.size() stk.size stk 1 stk.remove(stk.size()-1) stk.remove stk stk.size()-1 stk.size() stk.size stk 1 return tmp; tmp public int ans(){
        return stk.get(0);
    } ans {
        return stk.get(0);
    } return stk.get(0); stk.get(0) stk.get stk 0 class RPN{
    String[] exp;
    Stack stack;
    public RPN(String e){
        exp = e.split(" ", 0);
        stack = new Stack();
    }

    public void analyze(){
        int num;
        for(String str : exp){
            if(str.equals("+") || str.equals("-") || str.equals("*") || str.equals("/"))
	            stack.push(calc(stack.pop(),stack.pop(),str.charAt(0)));
            else
                stack.push(Integer.parseInt(str));
        }
        System.out.println(stack.ans());
    }
    int calc(int b, int a, char op){
        if(op=='+')
            return a+b;
        if(op=='*')
            return a*b;
        if(op=='-')
            return a-b;
        System.out.println("error");
        return 0;
    }
} RPN String[] exp; exp Stack stack; stack public RPN(String e){
        exp = e.split(" ", 0);
        stack = new Stack();
    } RPN {
        exp = e.split(" ", 0);
        stack = new Stack();
    } exp = e.split(" ", 0) exp e.split(" ", 0) e.split e " " 0 stack = new Stack() stack new Stack() String e e public void analyze(){
        int num;
        for(String str : exp){
            if(str.equals("+") || str.equals("-") || str.equals("*") || str.equals("/"))
	            stack.push(calc(stack.pop(),stack.pop(),str.charAt(0)));
            else
                stack.push(Integer.parseInt(str));
        }
        System.out.println(stack.ans());
    } analyze {
        int num;
        for(String str : exp){
            if(str.equals("+") || str.equals("-") || str.equals("*") || str.equals("/"))
	            stack.push(calc(stack.pop(),stack.pop(),str.charAt(0)));
            else
                stack.push(Integer.parseInt(str));
        }
        System.out.println(stack.ans());
    } int num; num for(String str : exp){
            if(str.equals("+") || str.equals("-") || str.equals("*") || str.equals("/"))
	            stack.push(calc(stack.pop(),stack.pop(),str.charAt(0)));
            else
                stack.push(Integer.parseInt(str));
        } String str exp {
            if(str.equals("+") || str.equals("-") || str.equals("*") || str.equals("/"))
	            stack.push(calc(stack.pop(),stack.pop(),str.charAt(0)));
            else
                stack.push(Integer.parseInt(str));
        } {
            if(str.equals("+") || str.equals("-") || str.equals("*") || str.equals("/"))
	            stack.push(calc(stack.pop(),stack.pop(),str.charAt(0)));
            else
                stack.push(Integer.parseInt(str));
        } if(str.equals("+") || str.equals("-") || str.equals("*") || str.equals("/"))
	            stack.push(calc(stack.pop(),stack.pop(),str.charAt(0)));
            else
                stack.push(Integer.parseInt(str)); str.equals("+") || str.equals("-") || str.equals("*") || str.equals("/") str.equals("*") str.equals("+") || str.equals("-") || str.equals("*") || str.equals("/") str.equals("+") str.equals str "+" str.equals("-") str.equals str "-" str.equals("*") str.equals str "*" str.equals("/") str.equals str "/" stack.push(calc(stack.pop(),stack.pop(),str.charAt(0))) stack.push stack calc(stack.pop(),stack.pop(),str.charAt(0)) calc stack.pop() stack.pop stack stack.pop() stack.pop stack str.charAt(0) str.charAt str 0 stack.push(Integer.parseInt(str)) stack.push stack Integer.parseInt(str) Integer.parseInt Integer str System.out.println(stack.ans()) System.out.println System.out System System.out stack.ans() stack.ans stack int calc(int b, int a, char op){
        if(op=='+')
            return a+b;
        if(op=='*')
            return a*b;
        if(op=='-')
            return a-b;
        System.out.println("error");
        return 0;
    } calc {
        if(op=='+')
            return a+b;
        if(op=='*')
            return a*b;
        if(op=='-')
            return a-b;
        System.out.println("error");
        return 0;
    } if(op=='+')
            return a+b; op=='+' op '+' return a+b; a+b a b if(op=='*')
            return a*b; op=='*' op '*' return a*b; a*b a b if(op=='-')
            return a-b; op=='-' op '-' return a-b; a-b a b System.out.println("error") System.out.println System.out System System.out "error" return 0; 0 int b b int a a char op op public class Main{ 

	public static void main(String args[]){
		
		Scanner scan = new Scanner(System.in);
		RPN rpn = new RPN(scan.nextLine());
        rpn.analyze();

	}
} public class Main{ 

	public static void main(String args[]){
		
		Scanner scan = new Scanner(System.in);
		RPN rpn = new RPN(scan.nextLine());
        rpn.analyze();

	}
} Main
import java.io.*;
import java.util.*;
public class Main{ 

	public static void main(String args[]){
		
		Scanner scan = new Scanner(System.in);
		RPN rpn = new RPN(scan.nextLine());
        rpn.analyze();

	}
}
class Stack{
    ArrayList<Integer> stk;
    public Stack(){
        stk = new ArrayList<Integer>();
    }
    public void push(int val){
        stk.add(val);
    }
    public int pop(){
        int tmp=stk.get(stk.size()-1);
        stk.remove(stk.size()-1);
        return tmp;
    }
    public int ans(){
        return stk.get(0);
    }
}
class RPN{
    String[] exp;
    Stack stack;
    public RPN(String e){
        exp = e.split(" ", 0);
        stack = new Stack();
    }

    public void analyze(){
        int num;
        for(String str : exp){
            if(str.equals("+") || str.equals("-") || str.equals("*") || str.equals("/"))
	            stack.push(calc(stack.pop(),stack.pop(),str.charAt(0)));
            else
                stack.push(Integer.parseInt(str));
        }
        System.out.println(stack.ans());
    }
    int calc(int b, int a, char op){
        if(op=='+')
            return a+b;
        if(op=='*')
            return a*b;
        if(op=='-')
            return a-b;
        System.out.println("error");
        return 0;
    }
}
 