import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.IOException;
import java.util.ArrayDeque;

public class Main{

    public static void main(String[] args) throws IOException{
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        ArrayDeque<Integer> stack = new ArrayDeque<Integer>();
        String[] t = br.readLine().split(" ");
        for(int i = 0; i < t.length; i++){
            if( t[i].equals("+") || t[i].equals("-") || t[i].equals("*") ){
                int ope1 = stack.pop();
                int ope2 = stack.pop();
                if(t[i].equals("+") ){
                    stack.push(ope1 + ope2);
                }else if(t[i].equals("-") ){
                    stack.push(ope2 - ope1);
                }else if(t[i].equals("*") ){
                    stack.push(ope1 * ope2);
                }
            }else{
                int ope = Integer.parseInt(t[i]);
                stack.push(ope);
            }
        }
        int ans = stack.pop();
        System.out.println(ans);
    }

} import java.io.BufferedReader; BufferedReader java.io import java.io.InputStreamReader; InputStreamReader java.io import java.io.IOException; IOException java.io import java.util.ArrayDeque; ArrayDeque java.util public class Main{

    public static void main(String[] args) throws IOException{
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        ArrayDeque<Integer> stack = new ArrayDeque<Integer>();
        String[] t = br.readLine().split(" ");
        for(int i = 0; i < t.length; i++){
            if( t[i].equals("+") || t[i].equals("-") || t[i].equals("*") ){
                int ope1 = stack.pop();
                int ope2 = stack.pop();
                if(t[i].equals("+") ){
                    stack.push(ope1 + ope2);
                }else if(t[i].equals("-") ){
                    stack.push(ope2 - ope1);
                }else if(t[i].equals("*") ){
                    stack.push(ope1 * ope2);
                }
            }else{
                int ope = Integer.parseInt(t[i]);
                stack.push(ope);
            }
        }
        int ans = stack.pop();
        System.out.println(ans);
    }

} Main public static void main(String[] args) throws IOException{
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        ArrayDeque<Integer> stack = new ArrayDeque<Integer>();
        String[] t = br.readLine().split(" ");
        for(int i = 0; i < t.length; i++){
            if( t[i].equals("+") || t[i].equals("-") || t[i].equals("*") ){
                int ope1 = stack.pop();
                int ope2 = stack.pop();
                if(t[i].equals("+") ){
                    stack.push(ope1 + ope2);
                }else if(t[i].equals("-") ){
                    stack.push(ope2 - ope1);
                }else if(t[i].equals("*") ){
                    stack.push(ope1 * ope2);
                }
            }else{
                int ope = Integer.parseInt(t[i]);
                stack.push(ope);
            }
        }
        int ans = stack.pop();
        System.out.println(ans);
    } main {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        ArrayDeque<Integer> stack = new ArrayDeque<Integer>();
        String[] t = br.readLine().split(" ");
        for(int i = 0; i < t.length; i++){
            if( t[i].equals("+") || t[i].equals("-") || t[i].equals("*") ){
                int ope1 = stack.pop();
                int ope2 = stack.pop();
                if(t[i].equals("+") ){
                    stack.push(ope1 + ope2);
                }else if(t[i].equals("-") ){
                    stack.push(ope2 - ope1);
                }else if(t[i].equals("*") ){
                    stack.push(ope1 * ope2);
                }
            }else{
                int ope = Integer.parseInt(t[i]);
                stack.push(ope);
            }
        }
        int ans = stack.pop();
        System.out.println(ans);
    } BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); br new BufferedReader(new InputStreamReader(System.in)) ArrayDeque<Integer> stack = new ArrayDeque<Integer>(); stack new ArrayDeque<Integer>() String[] t = br.readLine().split(" "); t br.readLine().split(" ") br.readLine().split br.readLine() br.readLine br " " for(int i = 0; i < t.length; i++){
            if( t[i].equals("+") || t[i].equals("-") || t[i].equals("*") ){
                int ope1 = stack.pop();
                int ope2 = stack.pop();
                if(t[i].equals("+") ){
                    stack.push(ope1 + ope2);
                }else if(t[i].equals("-") ){
                    stack.push(ope2 - ope1);
                }else if(t[i].equals("*") ){
                    stack.push(ope1 * ope2);
                }
            }else{
                int ope = Integer.parseInt(t[i]);
                stack.push(ope);
            }
        } int i = 0; int i = 0; i 0 i < t.length i t.length t t.length i++ i++ i {
            if( t[i].equals("+") || t[i].equals("-") || t[i].equals("*") ){
                int ope1 = stack.pop();
                int ope2 = stack.pop();
                if(t[i].equals("+") ){
                    stack.push(ope1 + ope2);
                }else if(t[i].equals("-") ){
                    stack.push(ope2 - ope1);
                }else if(t[i].equals("*") ){
                    stack.push(ope1 * ope2);
                }
            }else{
                int ope = Integer.parseInt(t[i]);
                stack.push(ope);
            }
        } {
            if( t[i].equals("+") || t[i].equals("-") || t[i].equals("*") ){
                int ope1 = stack.pop();
                int ope2 = stack.pop();
                if(t[i].equals("+") ){
                    stack.push(ope1 + ope2);
                }else if(t[i].equals("-") ){
                    stack.push(ope2 - ope1);
                }else if(t[i].equals("*") ){
                    stack.push(ope1 * ope2);
                }
            }else{
                int ope = Integer.parseInt(t[i]);
                stack.push(ope);
            }
        } if( t[i].equals("+") || t[i].equals("-") || t[i].equals("*") ){
                int ope1 = stack.pop();
                int ope2 = stack.pop();
                if(t[i].equals("+") ){
                    stack.push(ope1 + ope2);
                }else if(t[i].equals("-") ){
                    stack.push(ope2 - ope1);
                }else if(t[i].equals("*") ){
                    stack.push(ope1 * ope2);
                }
            }else{
                int ope = Integer.parseInt(t[i]);
                stack.push(ope);
            } t[i].equals("+") || t[i].equals("-") || t[i].equals("*") t[i].equals("+") || t[i].equals("-") || t[i].equals("*") t[i].equals("+") t[i].equals t[i] t i "+" t[i].equals("-") t[i].equals t[i] t i "-" t[i].equals("*") t[i].equals t[i] t i "*" {
                int ope1 = stack.pop();
                int ope2 = stack.pop();
                if(t[i].equals("+") ){
                    stack.push(ope1 + ope2);
                }else if(t[i].equals("-") ){
                    stack.push(ope2 - ope1);
                }else if(t[i].equals("*") ){
                    stack.push(ope1 * ope2);
                }
            } int ope1 = stack.pop(); ope1 stack.pop() stack.pop stack int ope2 = stack.pop(); ope2 stack.pop() stack.pop stack if(t[i].equals("+") ){
                    stack.push(ope1 + ope2);
                }else if(t[i].equals("-") ){
                    stack.push(ope2 - ope1);
                }else if(t[i].equals("*") ){
                    stack.push(ope1 * ope2);
                } t[i].equals("+") t[i].equals t[i] t i "+" {
                    stack.push(ope1 + ope2);
                } stack.push(ope1 + ope2) stack.push stack ope1 + ope2 ope1 ope2 if(t[i].equals("-") ){
                    stack.push(ope2 - ope1);
                }else if(t[i].equals("*") ){
                    stack.push(ope1 * ope2);
                } t[i].equals("-") t[i].equals t[i] t i "-" {
                    stack.push(ope2 - ope1);
                } stack.push(ope2 - ope1) stack.push stack ope2 - ope1 ope2 ope1 if(t[i].equals("*") ){
                    stack.push(ope1 * ope2);
                } t[i].equals("*") t[i].equals t[i] t i "*" {
                    stack.push(ope1 * ope2);
                } stack.push(ope1 * ope2) stack.push stack ope1 * ope2 ope1 ope2 {
                int ope = Integer.parseInt(t[i]);
                stack.push(ope);
            } int ope = Integer.parseInt(t[i]); ope Integer.parseInt(t[i]) Integer.parseInt Integer t[i] t i stack.push(ope) stack.push stack ope int ans = stack.pop(); ans stack.pop() stack.pop stack System.out.println(ans) System.out.println System.out System System.out ans String[] args args public class Main{

    public static void main(String[] args) throws IOException{
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        ArrayDeque<Integer> stack = new ArrayDeque<Integer>();
        String[] t = br.readLine().split(" ");
        for(int i = 0; i < t.length; i++){
            if( t[i].equals("+") || t[i].equals("-") || t[i].equals("*") ){
                int ope1 = stack.pop();
                int ope2 = stack.pop();
                if(t[i].equals("+") ){
                    stack.push(ope1 + ope2);
                }else if(t[i].equals("-") ){
                    stack.push(ope2 - ope1);
                }else if(t[i].equals("*") ){
                    stack.push(ope1 * ope2);
                }
            }else{
                int ope = Integer.parseInt(t[i]);
                stack.push(ope);
            }
        }
        int ans = stack.pop();
        System.out.println(ans);
    }

} public class Main{

    public static void main(String[] args) throws IOException{
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        ArrayDeque<Integer> stack = new ArrayDeque<Integer>();
        String[] t = br.readLine().split(" ");
        for(int i = 0; i < t.length; i++){
            if( t[i].equals("+") || t[i].equals("-") || t[i].equals("*") ){
                int ope1 = stack.pop();
                int ope2 = stack.pop();
                if(t[i].equals("+") ){
                    stack.push(ope1 + ope2);
                }else if(t[i].equals("-") ){
                    stack.push(ope2 - ope1);
                }else if(t[i].equals("*") ){
                    stack.push(ope1 * ope2);
                }
            }else{
                int ope = Integer.parseInt(t[i]);
                stack.push(ope);
            }
        }
        int ans = stack.pop();
        System.out.println(ans);
    }

} Main
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.IOException;
import java.util.ArrayDeque;

public class Main{

    public static void main(String[] args) throws IOException{
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        ArrayDeque<Integer> stack = new ArrayDeque<Integer>();
        String[] t = br.readLine().split(" ");
        for(int i = 0; i < t.length; i++){
            if( t[i].equals("+") || t[i].equals("-") || t[i].equals("*") ){
                int ope1 = stack.pop();
                int ope2 = stack.pop();
                if(t[i].equals("+") ){
                    stack.push(ope1 + ope2);
                }else if(t[i].equals("-") ){
                    stack.push(ope2 - ope1);
                }else if(t[i].equals("*") ){
                    stack.push(ope1 * ope2);
                }
            }else{
                int ope = Integer.parseInt(t[i]);
                stack.push(ope);
            }
        }
        int ans = stack.pop();
        System.out.println(ans);
    }

}