import java.util.Stack;
import java.io.*;
import java.util.regex.*;

public class Main {

    public static void main(String[] args) {

        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        Stack<Integer> S = new Stack<Integer>();
        int a, b;


        try{
            String input[] = br.readLine().split("\\s+");

            for(int i = 0; i < input.length; i++){
                if(!input[i].equals("+") && !input[i].equals("-") && !input[i].equals("*")) {
                     S.push(Integer.parseInt(input[i])); //intに変換
                    continue;
                }

                b = S.peek();
                S.pop();
                a = S.peek();
                S.pop();

                if(input[i].equals("+")) {
                    S.push(a+b);
                } else if(input[i].equals("-")) {
                    S.push(a-b);
                } else if(input[i].equals("*")) {
                    S.push(a*b);
                }
            }
            System.out.println(S.peek());

        } catch (IOException e) {
            e.printStackTrace();
        } catch (NumberFormatException e) {
            e.printStackTrace();
        }
    }

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

    public static void main(String[] args) {

        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        Stack<Integer> S = new Stack<Integer>();
        int a, b;


        try{
            String input[] = br.readLine().split("\\s+");

            for(int i = 0; i < input.length; i++){
                if(!input[i].equals("+") && !input[i].equals("-") && !input[i].equals("*")) {
                     S.push(Integer.parseInt(input[i])); //intに変換
                    continue;
                }

                b = S.peek();
                S.pop();
                a = S.peek();
                S.pop();

                if(input[i].equals("+")) {
                    S.push(a+b);
                } else if(input[i].equals("-")) {
                    S.push(a-b);
                } else if(input[i].equals("*")) {
                    S.push(a*b);
                }
            }
            System.out.println(S.peek());

        } catch (IOException e) {
            e.printStackTrace();
        } catch (NumberFormatException e) {
            e.printStackTrace();
        }
    }

} Main public static void main(String[] args) {

        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        Stack<Integer> S = new Stack<Integer>();
        int a, b;


        try{
            String input[] = br.readLine().split("\\s+");

            for(int i = 0; i < input.length; i++){
                if(!input[i].equals("+") && !input[i].equals("-") && !input[i].equals("*")) {
                     S.push(Integer.parseInt(input[i])); //intに変換
                    continue;
                }

                b = S.peek();
                S.pop();
                a = S.peek();
                S.pop();

                if(input[i].equals("+")) {
                    S.push(a+b);
                } else if(input[i].equals("-")) {
                    S.push(a-b);
                } else if(input[i].equals("*")) {
                    S.push(a*b);
                }
            }
            System.out.println(S.peek());

        } catch (IOException e) {
            e.printStackTrace();
        } catch (NumberFormatException e) {
            e.printStackTrace();
        }
    } main {

        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        Stack<Integer> S = new Stack<Integer>();
        int a, b;


        try{
            String input[] = br.readLine().split("\\s+");

            for(int i = 0; i < input.length; i++){
                if(!input[i].equals("+") && !input[i].equals("-") && !input[i].equals("*")) {
                     S.push(Integer.parseInt(input[i])); //intに変換
                    continue;
                }

                b = S.peek();
                S.pop();
                a = S.peek();
                S.pop();

                if(input[i].equals("+")) {
                    S.push(a+b);
                } else if(input[i].equals("-")) {
                    S.push(a-b);
                } else if(input[i].equals("*")) {
                    S.push(a*b);
                }
            }
            System.out.println(S.peek());

        } catch (IOException e) {
            e.printStackTrace();
        } catch (NumberFormatException e) {
            e.printStackTrace();
        }
    } BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); br new BufferedReader(new InputStreamReader(System.in)) Stack<Integer> S = new Stack<Integer>(); S new Stack<Integer>() int a a b; b try{
            String input[] = br.readLine().split("\\s+");

            for(int i = 0; i < input.length; i++){
                if(!input[i].equals("+") && !input[i].equals("-") && !input[i].equals("*")) {
                     S.push(Integer.parseInt(input[i])); //intに変換
                    continue;
                }

                b = S.peek();
                S.pop();
                a = S.peek();
                S.pop();

                if(input[i].equals("+")) {
                    S.push(a+b);
                } else if(input[i].equals("-")) {
                    S.push(a-b);
                } else if(input[i].equals("*")) {
                    S.push(a*b);
                }
            }
            System.out.println(S.peek());

        } catch (IOException e) {
            e.printStackTrace();
        } catch (NumberFormatException e) {
            e.printStackTrace();
        } catch (IOException e) {
            e.printStackTrace();
        } IOException e {
            e.printStackTrace();
        } e.printStackTrace() e.printStackTrace e catch (NumberFormatException e) {
            e.printStackTrace();
        } NumberFormatException e {
            e.printStackTrace();
        } e.printStackTrace() e.printStackTrace e {
            String input[] = br.readLine().split("\\s+");

            for(int i = 0; i < input.length; i++){
                if(!input[i].equals("+") && !input[i].equals("-") && !input[i].equals("*")) {
                     S.push(Integer.parseInt(input[i])); //intに変換
                    continue;
                }

                b = S.peek();
                S.pop();
                a = S.peek();
                S.pop();

                if(input[i].equals("+")) {
                    S.push(a+b);
                } else if(input[i].equals("-")) {
                    S.push(a-b);
                } else if(input[i].equals("*")) {
                    S.push(a*b);
                }
            }
            System.out.println(S.peek());

        } String input[] = br.readLine().split("\\s+"); input br.readLine().split("\\s+") br.readLine().split br.readLine() br.readLine br "\\s+" for(int i = 0; i < input.length; i++){
                if(!input[i].equals("+") && !input[i].equals("-") && !input[i].equals("*")) {
                     S.push(Integer.parseInt(input[i])); //intに変換
                    continue;
                }

                b = S.peek();
                S.pop();
                a = S.peek();
                S.pop();

                if(input[i].equals("+")) {
                    S.push(a+b);
                } else if(input[i].equals("-")) {
                    S.push(a-b);
                } else if(input[i].equals("*")) {
                    S.push(a*b);
                }
            } int i = 0; int i = 0; i 0 i < input.length i input.length input input.length i++ i++ i {
                if(!input[i].equals("+") && !input[i].equals("-") && !input[i].equals("*")) {
                     S.push(Integer.parseInt(input[i])); //intに変換
                    continue;
                }

                b = S.peek();
                S.pop();
                a = S.peek();
                S.pop();

                if(input[i].equals("+")) {
                    S.push(a+b);
                } else if(input[i].equals("-")) {
                    S.push(a-b);
                } else if(input[i].equals("*")) {
                    S.push(a*b);
                }
            } {
                if(!input[i].equals("+") && !input[i].equals("-") && !input[i].equals("*")) {
                     S.push(Integer.parseInt(input[i])); //intに変換
                    continue;
                }

                b = S.peek();
                S.pop();
                a = S.peek();
                S.pop();

                if(input[i].equals("+")) {
                    S.push(a+b);
                } else if(input[i].equals("-")) {
                    S.push(a-b);
                } else if(input[i].equals("*")) {
                    S.push(a*b);
                }
            } if(!input[i].equals("+") && !input[i].equals("-") && !input[i].equals("*")) {
                     S.push(Integer.parseInt(input[i])); //intに変換
                    continue;
                } !input[i].equals("+") && !input[i].equals("-") && !input[i].equals("*") !input[i].equals("+") && !input[i].equals("-") && !input[i].equals("*") !input[i].equals("+") input[i].equals("+") input[i].equals input[i] input i "+" !input[i].equals("-") input[i].equals("-") input[i].equals input[i] input i "-" !input[i].equals("*") input[i].equals("*") input[i].equals input[i] input i "*" {
                     S.push(Integer.parseInt(input[i])); //intに変換
                    continue;
                } S.push(Integer.parseInt(input[i])) S.push S Integer.parseInt(input[i]) Integer.parseInt Integer input[i] input i continue; b = S.peek() b S.peek() S.peek S S.pop() S.pop S a = S.peek() a S.peek() S.peek S S.pop() S.pop S if(input[i].equals("+")) {
                    S.push(a+b);
                } else if(input[i].equals("-")) {
                    S.push(a-b);
                } else if(input[i].equals("*")) {
                    S.push(a*b);
                } input[i].equals("+") input[i].equals input[i] input i "+" {
                    S.push(a+b);
                } S.push(a+b) S.push S a+b a b if(input[i].equals("-")) {
                    S.push(a-b);
                } else if(input[i].equals("*")) {
                    S.push(a*b);
                } input[i].equals("-") input[i].equals input[i] input i "-" {
                    S.push(a-b);
                } S.push(a-b) S.push S a-b a b if(input[i].equals("*")) {
                    S.push(a*b);
                } input[i].equals("*") input[i].equals input[i] input i "*" {
                    S.push(a*b);
                } S.push(a*b) S.push S a*b a b System.out.println(S.peek()) System.out.println System.out System System.out S.peek() S.peek S String[] args args public class Main {

    public static void main(String[] args) {

        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        Stack<Integer> S = new Stack<Integer>();
        int a, b;


        try{
            String input[] = br.readLine().split("\\s+");

            for(int i = 0; i < input.length; i++){
                if(!input[i].equals("+") && !input[i].equals("-") && !input[i].equals("*")) {
                     S.push(Integer.parseInt(input[i])); //intに変換
                    continue;
                }

                b = S.peek();
                S.pop();
                a = S.peek();
                S.pop();

                if(input[i].equals("+")) {
                    S.push(a+b);
                } else if(input[i].equals("-")) {
                    S.push(a-b);
                } else if(input[i].equals("*")) {
                    S.push(a*b);
                }
            }
            System.out.println(S.peek());

        } catch (IOException e) {
            e.printStackTrace();
        } catch (NumberFormatException e) {
            e.printStackTrace();
        }
    }

} public class Main {

    public static void main(String[] args) {

        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        Stack<Integer> S = new Stack<Integer>();
        int a, b;


        try{
            String input[] = br.readLine().split("\\s+");

            for(int i = 0; i < input.length; i++){
                if(!input[i].equals("+") && !input[i].equals("-") && !input[i].equals("*")) {
                     S.push(Integer.parseInt(input[i])); //intに変換
                    continue;
                }

                b = S.peek();
                S.pop();
                a = S.peek();
                S.pop();

                if(input[i].equals("+")) {
                    S.push(a+b);
                } else if(input[i].equals("-")) {
                    S.push(a-b);
                } else if(input[i].equals("*")) {
                    S.push(a*b);
                }
            }
            System.out.println(S.peek());

        } catch (IOException e) {
            e.printStackTrace();
        } catch (NumberFormatException e) {
            e.printStackTrace();
        }
    }

} Main
import java.util.Stack;
import java.io.*;
import java.util.regex.*;

public class Main {

    public static void main(String[] args) {

        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        Stack<Integer> S = new Stack<Integer>();
        int a, b;


        try{
            String input[] = br.readLine().split("\\s+");

            for(int i = 0; i < input.length; i++){
                if(!input[i].equals("+") && !input[i].equals("-") && !input[i].equals("*")) {
                     S.push(Integer.parseInt(input[i])); //intに変換
                    continue;
                }

                b = S.peek();
                S.pop();
                a = S.peek();
                S.pop();

                if(input[i].equals("+")) {
                    S.push(a+b);
                } else if(input[i].equals("-")) {
                    S.push(a-b);
                } else if(input[i].equals("*")) {
                    S.push(a*b);
                }
            }
            System.out.println(S.peek());

        } catch (IOException e) {
            e.printStackTrace();
        } catch (NumberFormatException e) {
            e.printStackTrace();
        }
    }

}

