import java.util.Arrays;
import java.util.Scanner;
import java.util.Stack;

public class Main {
    
    public static void solve(){
        Scanner scan = new Scanner(System.in);
        String expression;
        
        expression = scan.nextLine();
        String[] symbols = expression.split(" ");
        Stack<Integer> operands = new Stack<Integer>();
        
        for(String s: symbols){
            if(s.equals("+")){
                int a = operands.pop();
                int b = operands.pop();
                int res = b + a;
                operands.push(res);
            }else if(s.equals("-")){
                int a = operands.pop();
                int b = operands.pop();
                int res = b - a;
                operands.push(res);
            }else if(s.equals("*")){
                int a = operands.pop();
                int b = operands.pop();
                int res = b * a;
                operands.push(res);
            }else{
                int x = (int)Integer.parseInt(s);
                operands.push(x);
            }
        }
        int x = operands.pop();
        System.out.println(x);
    }
    
    public static void main(String[] args) {
        solve();
    }
    
}
 import java.util.Arrays; Arrays java.util import java.util.Scanner; Scanner java.util import java.util.Stack; Stack java.util public class Main {
    
    public static void solve(){
        Scanner scan = new Scanner(System.in);
        String expression;
        
        expression = scan.nextLine();
        String[] symbols = expression.split(" ");
        Stack<Integer> operands = new Stack<Integer>();
        
        for(String s: symbols){
            if(s.equals("+")){
                int a = operands.pop();
                int b = operands.pop();
                int res = b + a;
                operands.push(res);
            }else if(s.equals("-")){
                int a = operands.pop();
                int b = operands.pop();
                int res = b - a;
                operands.push(res);
            }else if(s.equals("*")){
                int a = operands.pop();
                int b = operands.pop();
                int res = b * a;
                operands.push(res);
            }else{
                int x = (int)Integer.parseInt(s);
                operands.push(x);
            }
        }
        int x = operands.pop();
        System.out.println(x);
    }
    
    public static void main(String[] args) {
        solve();
    }
    
} Main public static void solve(){
        Scanner scan = new Scanner(System.in);
        String expression;
        
        expression = scan.nextLine();
        String[] symbols = expression.split(" ");
        Stack<Integer> operands = new Stack<Integer>();
        
        for(String s: symbols){
            if(s.equals("+")){
                int a = operands.pop();
                int b = operands.pop();
                int res = b + a;
                operands.push(res);
            }else if(s.equals("-")){
                int a = operands.pop();
                int b = operands.pop();
                int res = b - a;
                operands.push(res);
            }else if(s.equals("*")){
                int a = operands.pop();
                int b = operands.pop();
                int res = b * a;
                operands.push(res);
            }else{
                int x = (int)Integer.parseInt(s);
                operands.push(x);
            }
        }
        int x = operands.pop();
        System.out.println(x);
    } solve {
        Scanner scan = new Scanner(System.in);
        String expression;
        
        expression = scan.nextLine();
        String[] symbols = expression.split(" ");
        Stack<Integer> operands = new Stack<Integer>();
        
        for(String s: symbols){
            if(s.equals("+")){
                int a = operands.pop();
                int b = operands.pop();
                int res = b + a;
                operands.push(res);
            }else if(s.equals("-")){
                int a = operands.pop();
                int b = operands.pop();
                int res = b - a;
                operands.push(res);
            }else if(s.equals("*")){
                int a = operands.pop();
                int b = operands.pop();
                int res = b * a;
                operands.push(res);
            }else{
                int x = (int)Integer.parseInt(s);
                operands.push(x);
            }
        }
        int x = operands.pop();
        System.out.println(x);
    } Scanner scan = new Scanner(System.in); scan new Scanner(System.in) String expression; expression expression = scan.nextLine() expression scan.nextLine() scan.nextLine scan String[] symbols = expression.split(" "); symbols expression.split(" ") expression.split expression " " Stack<Integer> operands = new Stack<Integer>(); operands new Stack<Integer>() for(String s: symbols){
            if(s.equals("+")){
                int a = operands.pop();
                int b = operands.pop();
                int res = b + a;
                operands.push(res);
            }else if(s.equals("-")){
                int a = operands.pop();
                int b = operands.pop();
                int res = b - a;
                operands.push(res);
            }else if(s.equals("*")){
                int a = operands.pop();
                int b = operands.pop();
                int res = b * a;
                operands.push(res);
            }else{
                int x = (int)Integer.parseInt(s);
                operands.push(x);
            }
        } String s symbols {
            if(s.equals("+")){
                int a = operands.pop();
                int b = operands.pop();
                int res = b + a;
                operands.push(res);
            }else if(s.equals("-")){
                int a = operands.pop();
                int b = operands.pop();
                int res = b - a;
                operands.push(res);
            }else if(s.equals("*")){
                int a = operands.pop();
                int b = operands.pop();
                int res = b * a;
                operands.push(res);
            }else{
                int x = (int)Integer.parseInt(s);
                operands.push(x);
            }
        } {
            if(s.equals("+")){
                int a = operands.pop();
                int b = operands.pop();
                int res = b + a;
                operands.push(res);
            }else if(s.equals("-")){
                int a = operands.pop();
                int b = operands.pop();
                int res = b - a;
                operands.push(res);
            }else if(s.equals("*")){
                int a = operands.pop();
                int b = operands.pop();
                int res = b * a;
                operands.push(res);
            }else{
                int x = (int)Integer.parseInt(s);
                operands.push(x);
            }
        } if(s.equals("+")){
                int a = operands.pop();
                int b = operands.pop();
                int res = b + a;
                operands.push(res);
            }else if(s.equals("-")){
                int a = operands.pop();
                int b = operands.pop();
                int res = b - a;
                operands.push(res);
            }else if(s.equals("*")){
                int a = operands.pop();
                int b = operands.pop();
                int res = b * a;
                operands.push(res);
            }else{
                int x = (int)Integer.parseInt(s);
                operands.push(x);
            } s.equals("+") s.equals s "+" {
                int a = operands.pop();
                int b = operands.pop();
                int res = b + a;
                operands.push(res);
            } int a = operands.pop(); a operands.pop() operands.pop operands int b = operands.pop(); b operands.pop() operands.pop operands int res = b + a; res b + a b a operands.push(res) operands.push operands res if(s.equals("-")){
                int a = operands.pop();
                int b = operands.pop();
                int res = b - a;
                operands.push(res);
            }else if(s.equals("*")){
                int a = operands.pop();
                int b = operands.pop();
                int res = b * a;
                operands.push(res);
            }else{
                int x = (int)Integer.parseInt(s);
                operands.push(x);
            } s.equals("-") s.equals s "-" {
                int a = operands.pop();
                int b = operands.pop();
                int res = b - a;
                operands.push(res);
            } int a = operands.pop(); a operands.pop() operands.pop operands int b = operands.pop(); b operands.pop() operands.pop operands int res = b - a; res b - a b a operands.push(res) operands.push operands res if(s.equals("*")){
                int a = operands.pop();
                int b = operands.pop();
                int res = b * a;
                operands.push(res);
            }else{
                int x = (int)Integer.parseInt(s);
                operands.push(x);
            } s.equals("*") s.equals s "*" {
                int a = operands.pop();
                int b = operands.pop();
                int res = b * a;
                operands.push(res);
            } int a = operands.pop(); a operands.pop() operands.pop operands int b = operands.pop(); b operands.pop() operands.pop operands int res = b * a; res b * a b a operands.push(res) operands.push operands res {
                int x = (int)Integer.parseInt(s);
                operands.push(x);
            } int x = (int)Integer.parseInt(s); x (int)Integer.parseInt(s) Integer.parseInt Integer s operands.push(x) operands.push operands x int x = operands.pop(); x operands.pop() operands.pop operands System.out.println(x) System.out.println System.out System System.out x public static void main(String[] args) {
        solve();
    } main {
        solve();
    } solve() solve String[] args args public class Main {
    
    public static void solve(){
        Scanner scan = new Scanner(System.in);
        String expression;
        
        expression = scan.nextLine();
        String[] symbols = expression.split(" ");
        Stack<Integer> operands = new Stack<Integer>();
        
        for(String s: symbols){
            if(s.equals("+")){
                int a = operands.pop();
                int b = operands.pop();
                int res = b + a;
                operands.push(res);
            }else if(s.equals("-")){
                int a = operands.pop();
                int b = operands.pop();
                int res = b - a;
                operands.push(res);
            }else if(s.equals("*")){
                int a = operands.pop();
                int b = operands.pop();
                int res = b * a;
                operands.push(res);
            }else{
                int x = (int)Integer.parseInt(s);
                operands.push(x);
            }
        }
        int x = operands.pop();
        System.out.println(x);
    }
    
    public static void main(String[] args) {
        solve();
    }
    
} public class Main {
    
    public static void solve(){
        Scanner scan = new Scanner(System.in);
        String expression;
        
        expression = scan.nextLine();
        String[] symbols = expression.split(" ");
        Stack<Integer> operands = new Stack<Integer>();
        
        for(String s: symbols){
            if(s.equals("+")){
                int a = operands.pop();
                int b = operands.pop();
                int res = b + a;
                operands.push(res);
            }else if(s.equals("-")){
                int a = operands.pop();
                int b = operands.pop();
                int res = b - a;
                operands.push(res);
            }else if(s.equals("*")){
                int a = operands.pop();
                int b = operands.pop();
                int res = b * a;
                operands.push(res);
            }else{
                int x = (int)Integer.parseInt(s);
                operands.push(x);
            }
        }
        int x = operands.pop();
        System.out.println(x);
    }
    
    public static void main(String[] args) {
        solve();
    }
    
} Main
import java.util.Arrays;
import java.util.Scanner;
import java.util.Stack;

public class Main {
    
    public static void solve(){
        Scanner scan = new Scanner(System.in);
        String expression;
        
        expression = scan.nextLine();
        String[] symbols = expression.split(" ");
        Stack<Integer> operands = new Stack<Integer>();
        
        for(String s: symbols){
            if(s.equals("+")){
                int a = operands.pop();
                int b = operands.pop();
                int res = b + a;
                operands.push(res);
            }else if(s.equals("-")){
                int a = operands.pop();
                int b = operands.pop();
                int res = b - a;
                operands.push(res);
            }else if(s.equals("*")){
                int a = operands.pop();
                int b = operands.pop();
                int res = b * a;
                operands.push(res);
            }else{
                int x = (int)Integer.parseInt(s);
                operands.push(x);
            }
        }
        int x = operands.pop();
        System.out.println(x);
    }
    
    public static void main(String[] args) {
        solve();
    }
    
}

