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

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String[] line = sc.nextLine().split(" ");
        Stack<Integer> stack = new Stack<Integer>();
        int a=0,b=0;
        for(int i=0; i<line.length; i++){
            if(line[i].equals("+")) {
                a = stack.pop();
                b = stack.pop();
                stack.push(b+a);
            } else if (line[i].equals("-")) {
                a = stack.pop();
                b = stack.pop();
                stack.push(b-a);
            } else if (line[i].equals("*")) {
                a = stack.pop();
                b = stack.pop();
                stack.push(b*a);
            } else {
                stack.push(Integer.parseInt(line[i]));
            }
        }
        System.out.println(stack.pop());
    }
}
 import java.util.ArrayDeque; ArrayDeque java.util import java.util.Arrays; Arrays java.util import java.util.Deque; Deque java.util import java.util.Scanner; Scanner java.util import java.util.Stack; Stack java.util public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String[] line = sc.nextLine().split(" ");
        Stack<Integer> stack = new Stack<Integer>();
        int a=0,b=0;
        for(int i=0; i<line.length; i++){
            if(line[i].equals("+")) {
                a = stack.pop();
                b = stack.pop();
                stack.push(b+a);
            } else if (line[i].equals("-")) {
                a = stack.pop();
                b = stack.pop();
                stack.push(b-a);
            } else if (line[i].equals("*")) {
                a = stack.pop();
                b = stack.pop();
                stack.push(b*a);
            } else {
                stack.push(Integer.parseInt(line[i]));
            }
        }
        System.out.println(stack.pop());
    }
} Main public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String[] line = sc.nextLine().split(" ");
        Stack<Integer> stack = new Stack<Integer>();
        int a=0,b=0;
        for(int i=0; i<line.length; i++){
            if(line[i].equals("+")) {
                a = stack.pop();
                b = stack.pop();
                stack.push(b+a);
            } else if (line[i].equals("-")) {
                a = stack.pop();
                b = stack.pop();
                stack.push(b-a);
            } else if (line[i].equals("*")) {
                a = stack.pop();
                b = stack.pop();
                stack.push(b*a);
            } else {
                stack.push(Integer.parseInt(line[i]));
            }
        }
        System.out.println(stack.pop());
    } main {
        Scanner sc = new Scanner(System.in);
        String[] line = sc.nextLine().split(" ");
        Stack<Integer> stack = new Stack<Integer>();
        int a=0,b=0;
        for(int i=0; i<line.length; i++){
            if(line[i].equals("+")) {
                a = stack.pop();
                b = stack.pop();
                stack.push(b+a);
            } else if (line[i].equals("-")) {
                a = stack.pop();
                b = stack.pop();
                stack.push(b-a);
            } else if (line[i].equals("*")) {
                a = stack.pop();
                b = stack.pop();
                stack.push(b*a);
            } else {
                stack.push(Integer.parseInt(line[i]));
            }
        }
        System.out.println(stack.pop());
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String[] line = sc.nextLine().split(" "); line sc.nextLine().split(" ") sc.nextLine().split sc.nextLine() sc.nextLine sc " " Stack<Integer> stack = new Stack<Integer>(); stack new Stack<Integer>() int a=0 a 0 b=0; b 0 for(int i=0; i<line.length; i++){
            if(line[i].equals("+")) {
                a = stack.pop();
                b = stack.pop();
                stack.push(b+a);
            } else if (line[i].equals("-")) {
                a = stack.pop();
                b = stack.pop();
                stack.push(b-a);
            } else if (line[i].equals("*")) {
                a = stack.pop();
                b = stack.pop();
                stack.push(b*a);
            } else {
                stack.push(Integer.parseInt(line[i]));
            }
        } int i=0; int i=0; i 0 i<line.length i line.length line line.length i++ i++ i {
            if(line[i].equals("+")) {
                a = stack.pop();
                b = stack.pop();
                stack.push(b+a);
            } else if (line[i].equals("-")) {
                a = stack.pop();
                b = stack.pop();
                stack.push(b-a);
            } else if (line[i].equals("*")) {
                a = stack.pop();
                b = stack.pop();
                stack.push(b*a);
            } else {
                stack.push(Integer.parseInt(line[i]));
            }
        } {
            if(line[i].equals("+")) {
                a = stack.pop();
                b = stack.pop();
                stack.push(b+a);
            } else if (line[i].equals("-")) {
                a = stack.pop();
                b = stack.pop();
                stack.push(b-a);
            } else if (line[i].equals("*")) {
                a = stack.pop();
                b = stack.pop();
                stack.push(b*a);
            } else {
                stack.push(Integer.parseInt(line[i]));
            }
        } if(line[i].equals("+")) {
                a = stack.pop();
                b = stack.pop();
                stack.push(b+a);
            } else if (line[i].equals("-")) {
                a = stack.pop();
                b = stack.pop();
                stack.push(b-a);
            } else if (line[i].equals("*")) {
                a = stack.pop();
                b = stack.pop();
                stack.push(b*a);
            } else {
                stack.push(Integer.parseInt(line[i]));
            } line[i].equals("+") line[i].equals line[i] line i "+" {
                a = stack.pop();
                b = stack.pop();
                stack.push(b+a);
            } a = stack.pop() a stack.pop() stack.pop stack b = stack.pop() b stack.pop() stack.pop stack stack.push(b+a) stack.push stack b+a b a if (line[i].equals("-")) {
                a = stack.pop();
                b = stack.pop();
                stack.push(b-a);
            } else if (line[i].equals("*")) {
                a = stack.pop();
                b = stack.pop();
                stack.push(b*a);
            } else {
                stack.push(Integer.parseInt(line[i]));
            } line[i].equals("-") line[i].equals line[i] line i "-" {
                a = stack.pop();
                b = stack.pop();
                stack.push(b-a);
            } a = stack.pop() a stack.pop() stack.pop stack b = stack.pop() b stack.pop() stack.pop stack stack.push(b-a) stack.push stack b-a b a if (line[i].equals("*")) {
                a = stack.pop();
                b = stack.pop();
                stack.push(b*a);
            } else {
                stack.push(Integer.parseInt(line[i]));
            } line[i].equals("*") line[i].equals line[i] line i "*" {
                a = stack.pop();
                b = stack.pop();
                stack.push(b*a);
            } a = stack.pop() a stack.pop() stack.pop stack b = stack.pop() b stack.pop() stack.pop stack stack.push(b*a) stack.push stack b*a b a {
                stack.push(Integer.parseInt(line[i]));
            } stack.push(Integer.parseInt(line[i])) stack.push stack Integer.parseInt(line[i]) Integer.parseInt Integer line[i] line i System.out.println(stack.pop()) System.out.println System.out System System.out stack.pop() stack.pop stack String[] args args public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String[] line = sc.nextLine().split(" ");
        Stack<Integer> stack = new Stack<Integer>();
        int a=0,b=0;
        for(int i=0; i<line.length; i++){
            if(line[i].equals("+")) {
                a = stack.pop();
                b = stack.pop();
                stack.push(b+a);
            } else if (line[i].equals("-")) {
                a = stack.pop();
                b = stack.pop();
                stack.push(b-a);
            } else if (line[i].equals("*")) {
                a = stack.pop();
                b = stack.pop();
                stack.push(b*a);
            } else {
                stack.push(Integer.parseInt(line[i]));
            }
        }
        System.out.println(stack.pop());
    }
} public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String[] line = sc.nextLine().split(" ");
        Stack<Integer> stack = new Stack<Integer>();
        int a=0,b=0;
        for(int i=0; i<line.length; i++){
            if(line[i].equals("+")) {
                a = stack.pop();
                b = stack.pop();
                stack.push(b+a);
            } else if (line[i].equals("-")) {
                a = stack.pop();
                b = stack.pop();
                stack.push(b-a);
            } else if (line[i].equals("*")) {
                a = stack.pop();
                b = stack.pop();
                stack.push(b*a);
            } else {
                stack.push(Integer.parseInt(line[i]));
            }
        }
        System.out.println(stack.pop());
    }
} Main
import java.util.ArrayDeque;
import java.util.Arrays;
import java.util.Deque;
import java.util.Scanner;
import java.util.Stack;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String[] line = sc.nextLine().split(" ");
        Stack<Integer> stack = new Stack<Integer>();
        int a=0,b=0;
        for(int i=0; i<line.length; i++){
            if(line[i].equals("+")) {
                a = stack.pop();
                b = stack.pop();
                stack.push(b+a);
            } else if (line[i].equals("-")) {
                a = stack.pop();
                b = stack.pop();
                stack.push(b-a);
            } else if (line[i].equals("*")) {
                a = stack.pop();
                b = stack.pop();
                stack.push(b*a);
            } else {
                stack.push(Integer.parseInt(line[i]));
            }
        }
        System.out.println(stack.pop());
    }
}

