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

public class Main {
    public Main() {
        Scanner scan = new Scanner(System.in);

        Stack stack = new Stack(200);

        while(scan.hasNext()){
            String str = scan.next();
            stack.push(str);
        }
        System.out.println(stack.pop());
    }

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

    private class Stack{
        private int top = 0;
        private int stack[];

        public Stack(int size){
            stack = new int[size];
        }

        public void push(int n){
            stack[top++] = n;
        }

        public void push(String str){
            if(isInteger(str)){
                int n = Integer.parseInt(str);
                push(n);
            }else{
                int o1 = pop();
                int o2 = pop();

                if(str.equals("+")){
                    push(o2+o1);
                }
                else if(str.equals("-")){
                    push(o2-o1);
                }else{
                    push(o2*o1);
                }
            }
        }

        public int pop(){
            return stack[--top];
        }

        public boolean isInteger(String str) {
            try {
                Integer.parseInt(str);
            } catch(NumberFormatException e) {
                return false;
            }
            return true;
        }

    }

} import java.util.Arrays; Arrays java.util import java.util.Scanner; Scanner java.util public class Main {
    public Main() {
        Scanner scan = new Scanner(System.in);

        Stack stack = new Stack(200);

        while(scan.hasNext()){
            String str = scan.next();
            stack.push(str);
        }
        System.out.println(stack.pop());
    }

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

    private class Stack{
        private int top = 0;
        private int stack[];

        public Stack(int size){
            stack = new int[size];
        }

        public void push(int n){
            stack[top++] = n;
        }

        public void push(String str){
            if(isInteger(str)){
                int n = Integer.parseInt(str);
                push(n);
            }else{
                int o1 = pop();
                int o2 = pop();

                if(str.equals("+")){
                    push(o2+o1);
                }
                else if(str.equals("-")){
                    push(o2-o1);
                }else{
                    push(o2*o1);
                }
            }
        }

        public int pop(){
            return stack[--top];
        }

        public boolean isInteger(String str) {
            try {
                Integer.parseInt(str);
            } catch(NumberFormatException e) {
                return false;
            }
            return true;
        }

    }

} Main public Main() {
        Scanner scan = new Scanner(System.in);

        Stack stack = new Stack(200);

        while(scan.hasNext()){
            String str = scan.next();
            stack.push(str);
        }
        System.out.println(stack.pop());
    } Main {
        Scanner scan = new Scanner(System.in);

        Stack stack = new Stack(200);

        while(scan.hasNext()){
            String str = scan.next();
            stack.push(str);
        }
        System.out.println(stack.pop());
    } Scanner scan = new Scanner(System.in); scan new Scanner(System.in) Stack stack = new Stack(200); stack new Stack(200) while(scan.hasNext()){
            String str = scan.next();
            stack.push(str);
        } scan.hasNext() scan.hasNext scan {
            String str = scan.next();
            stack.push(str);
        } String str = scan.next(); str scan.next() scan.next scan stack.push(str) stack.push stack str System.out.println(stack.pop()) System.out.println System.out System System.out stack.pop() stack.pop stack public static void main(String[] args) {
        new Main();
    } main {
        new Main();
    } new Main() String[] args args private class Stack{
        private int top = 0;
        private int stack[];

        public Stack(int size){
            stack = new int[size];
        }

        public void push(int n){
            stack[top++] = n;
        }

        public void push(String str){
            if(isInteger(str)){
                int n = Integer.parseInt(str);
                push(n);
            }else{
                int o1 = pop();
                int o2 = pop();

                if(str.equals("+")){
                    push(o2+o1);
                }
                else if(str.equals("-")){
                    push(o2-o1);
                }else{
                    push(o2*o1);
                }
            }
        }

        public int pop(){
            return stack[--top];
        }

        public boolean isInteger(String str) {
            try {
                Integer.parseInt(str);
            } catch(NumberFormatException e) {
                return false;
            }
            return true;
        }

    } Stack private int top = 0; top 0 private int stack[]; stack public Stack(int size){
            stack = new int[size];
        } Stack {
            stack = new int[size];
        } stack = new int[size] stack new int[size] size int size size public void push(int n){
            stack[top++] = n;
        } push {
            stack[top++] = n;
        } stack[top++] = n stack[top++] stack top++ top n int n n public void push(String str){
            if(isInteger(str)){
                int n = Integer.parseInt(str);
                push(n);
            }else{
                int o1 = pop();
                int o2 = pop();

                if(str.equals("+")){
                    push(o2+o1);
                }
                else if(str.equals("-")){
                    push(o2-o1);
                }else{
                    push(o2*o1);
                }
            }
        } push {
            if(isInteger(str)){
                int n = Integer.parseInt(str);
                push(n);
            }else{
                int o1 = pop();
                int o2 = pop();

                if(str.equals("+")){
                    push(o2+o1);
                }
                else if(str.equals("-")){
                    push(o2-o1);
                }else{
                    push(o2*o1);
                }
            }
        } if(isInteger(str)){
                int n = Integer.parseInt(str);
                push(n);
            }else{
                int o1 = pop();
                int o2 = pop();

                if(str.equals("+")){
                    push(o2+o1);
                }
                else if(str.equals("-")){
                    push(o2-o1);
                }else{
                    push(o2*o1);
                }
            } isInteger(str) isInteger str {
                int n = Integer.parseInt(str);
                push(n);
            } int n = Integer.parseInt(str); n Integer.parseInt(str) Integer.parseInt Integer str push(n) push n {
                int o1 = pop();
                int o2 = pop();

                if(str.equals("+")){
                    push(o2+o1);
                }
                else if(str.equals("-")){
                    push(o2-o1);
                }else{
                    push(o2*o1);
                }
            } int o1 = pop(); o1 pop() pop int o2 = pop(); o2 pop() pop if(str.equals("+")){
                    push(o2+o1);
                }
                else if(str.equals("-")){
                    push(o2-o1);
                }else{
                    push(o2*o1);
                } str.equals("+") str.equals str "+" {
                    push(o2+o1);
                } push(o2+o1) push o2+o1 o2 o1 if(str.equals("-")){
                    push(o2-o1);
                }else{
                    push(o2*o1);
                } str.equals("-") str.equals str "-" {
                    push(o2-o1);
                } push(o2-o1) push o2-o1 o2 o1 {
                    push(o2*o1);
                } push(o2*o1) push o2*o1 o2 o1 String str str public int pop(){
            return stack[--top];
        } pop {
            return stack[--top];
        } return stack[--top]; stack[--top] stack --top top public boolean isInteger(String str) {
            try {
                Integer.parseInt(str);
            } catch(NumberFormatException e) {
                return false;
            }
            return true;
        } isInteger {
            try {
                Integer.parseInt(str);
            } catch(NumberFormatException e) {
                return false;
            }
            return true;
        } try {
                Integer.parseInt(str);
            } catch(NumberFormatException e) {
                return false;
            } catch(NumberFormatException e) {
                return false;
            } NumberFormatException e {
                return false;
            } return false; false {
                Integer.parseInt(str);
            } Integer.parseInt(str) Integer.parseInt Integer str return true; true String str str public class Main {
    public Main() {
        Scanner scan = new Scanner(System.in);

        Stack stack = new Stack(200);

        while(scan.hasNext()){
            String str = scan.next();
            stack.push(str);
        }
        System.out.println(stack.pop());
    }

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

    private class Stack{
        private int top = 0;
        private int stack[];

        public Stack(int size){
            stack = new int[size];
        }

        public void push(int n){
            stack[top++] = n;
        }

        public void push(String str){
            if(isInteger(str)){
                int n = Integer.parseInt(str);
                push(n);
            }else{
                int o1 = pop();
                int o2 = pop();

                if(str.equals("+")){
                    push(o2+o1);
                }
                else if(str.equals("-")){
                    push(o2-o1);
                }else{
                    push(o2*o1);
                }
            }
        }

        public int pop(){
            return stack[--top];
        }

        public boolean isInteger(String str) {
            try {
                Integer.parseInt(str);
            } catch(NumberFormatException e) {
                return false;
            }
            return true;
        }

    }

} public class Main {
    public Main() {
        Scanner scan = new Scanner(System.in);

        Stack stack = new Stack(200);

        while(scan.hasNext()){
            String str = scan.next();
            stack.push(str);
        }
        System.out.println(stack.pop());
    }

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

    private class Stack{
        private int top = 0;
        private int stack[];

        public Stack(int size){
            stack = new int[size];
        }

        public void push(int n){
            stack[top++] = n;
        }

        public void push(String str){
            if(isInteger(str)){
                int n = Integer.parseInt(str);
                push(n);
            }else{
                int o1 = pop();
                int o2 = pop();

                if(str.equals("+")){
                    push(o2+o1);
                }
                else if(str.equals("-")){
                    push(o2-o1);
                }else{
                    push(o2*o1);
                }
            }
        }

        public int pop(){
            return stack[--top];
        }

        public boolean isInteger(String str) {
            try {
                Integer.parseInt(str);
            } catch(NumberFormatException e) {
                return false;
            }
            return true;
        }

    }

} Main
import java.util.Arrays;
import java.util.Scanner;

public class Main {
    public Main() {
        Scanner scan = new Scanner(System.in);

        Stack stack = new Stack(200);

        while(scan.hasNext()){
            String str = scan.next();
            stack.push(str);
        }
        System.out.println(stack.pop());
    }

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

    private class Stack{
        private int top = 0;
        private int stack[];

        public Stack(int size){
            stack = new int[size];
        }

        public void push(int n){
            stack[top++] = n;
        }

        public void push(String str){
            if(isInteger(str)){
                int n = Integer.parseInt(str);
                push(n);
            }else{
                int o1 = pop();
                int o2 = pop();

                if(str.equals("+")){
                    push(o2+o1);
                }
                else if(str.equals("-")){
                    push(o2-o1);
                }else{
                    push(o2*o1);
                }
            }
        }

        public int pop(){
            return stack[--top];
        }

        public boolean isInteger(String str) {
            try {
                Integer.parseInt(str);
            } catch(NumberFormatException e) {
                return false;
            }
            return true;
        }

    }

}