import java.util.Scanner;

public class Main {

    static int top = 0;
    static int[] num = new int[1000];

    public static void push(int x){

        num[++top] = x;
    }

    public static int pop(){

        top--;
        return num[top+1];
    }

    public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);
        String str = sc.nextLine();

        String[] strings = str.split(" ");
        for (int i=0; i<strings.length; i++){
            if (strings[i].equals("+")){
                int a = pop();
                int b = pop();
                push(a+b);
            }
            else if (strings[i].equals("-")){
                int a = pop();
                int b = pop();
                push(b-a);
            }
            else if (strings[i].equals("*")){
                int a = pop();
                int b = pop();
                push(a*b);
            }
            else {
                push(Integer.parseInt(strings[i]));
            }
        }

        System.out.println(pop());
    }
} import java.util.Scanner; Scanner java.util public class Main {

    static int top = 0;
    static int[] num = new int[1000];

    public static void push(int x){

        num[++top] = x;
    }

    public static int pop(){

        top--;
        return num[top+1];
    }

    public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);
        String str = sc.nextLine();

        String[] strings = str.split(" ");
        for (int i=0; i<strings.length; i++){
            if (strings[i].equals("+")){
                int a = pop();
                int b = pop();
                push(a+b);
            }
            else if (strings[i].equals("-")){
                int a = pop();
                int b = pop();
                push(b-a);
            }
            else if (strings[i].equals("*")){
                int a = pop();
                int b = pop();
                push(a*b);
            }
            else {
                push(Integer.parseInt(strings[i]));
            }
        }

        System.out.println(pop());
    }
} Main static int top = 0; top 0 static int[] num = new int[1000]; num new int[1000] 1000 public static void push(int x){

        num[++top] = x;
    } push {

        num[++top] = x;
    } num[++top] = x num[++top] num ++top top x int x x public static int pop(){

        top--;
        return num[top+1];
    } pop {

        top--;
        return num[top+1];
    } top-- top return num[top+1]; num[top+1] num top+1 top 1 public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);
        String str = sc.nextLine();

        String[] strings = str.split(" ");
        for (int i=0; i<strings.length; i++){
            if (strings[i].equals("+")){
                int a = pop();
                int b = pop();
                push(a+b);
            }
            else if (strings[i].equals("-")){
                int a = pop();
                int b = pop();
                push(b-a);
            }
            else if (strings[i].equals("*")){
                int a = pop();
                int b = pop();
                push(a*b);
            }
            else {
                push(Integer.parseInt(strings[i]));
            }
        }

        System.out.println(pop());
    } main {

        Scanner sc = new Scanner(System.in);
        String str = sc.nextLine();

        String[] strings = str.split(" ");
        for (int i=0; i<strings.length; i++){
            if (strings[i].equals("+")){
                int a = pop();
                int b = pop();
                push(a+b);
            }
            else if (strings[i].equals("-")){
                int a = pop();
                int b = pop();
                push(b-a);
            }
            else if (strings[i].equals("*")){
                int a = pop();
                int b = pop();
                push(a*b);
            }
            else {
                push(Integer.parseInt(strings[i]));
            }
        }

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

    static int top = 0;
    static int[] num = new int[1000];

    public static void push(int x){

        num[++top] = x;
    }

    public static int pop(){

        top--;
        return num[top+1];
    }

    public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);
        String str = sc.nextLine();

        String[] strings = str.split(" ");
        for (int i=0; i<strings.length; i++){
            if (strings[i].equals("+")){
                int a = pop();
                int b = pop();
                push(a+b);
            }
            else if (strings[i].equals("-")){
                int a = pop();
                int b = pop();
                push(b-a);
            }
            else if (strings[i].equals("*")){
                int a = pop();
                int b = pop();
                push(a*b);
            }
            else {
                push(Integer.parseInt(strings[i]));
            }
        }

        System.out.println(pop());
    }
} public class Main {

    static int top = 0;
    static int[] num = new int[1000];

    public static void push(int x){

        num[++top] = x;
    }

    public static int pop(){

        top--;
        return num[top+1];
    }

    public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);
        String str = sc.nextLine();

        String[] strings = str.split(" ");
        for (int i=0; i<strings.length; i++){
            if (strings[i].equals("+")){
                int a = pop();
                int b = pop();
                push(a+b);
            }
            else if (strings[i].equals("-")){
                int a = pop();
                int b = pop();
                push(b-a);
            }
            else if (strings[i].equals("*")){
                int a = pop();
                int b = pop();
                push(a*b);
            }
            else {
                push(Integer.parseInt(strings[i]));
            }
        }

        System.out.println(pop());
    }
} Main
import java.util.Scanner;

public class Main {

    static int top = 0;
    static int[] num = new int[1000];

    public static void push(int x){

        num[++top] = x;
    }

    public static int pop(){

        top--;
        return num[top+1];
    }

    public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);
        String str = sc.nextLine();

        String[] strings = str.split(" ");
        for (int i=0; i<strings.length; i++){
            if (strings[i].equals("+")){
                int a = pop();
                int b = pop();
                push(a+b);
            }
            else if (strings[i].equals("-")){
                int a = pop();
                int b = pop();
                push(b-a);
            }
            else if (strings[i].equals("*")){
                int a = pop();
                int b = pop();
                push(a*b);
            }
            else {
                push(Integer.parseInt(strings[i]));
            }
        }

        System.out.println(pop());
    }
}