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

public class Main {
    static int top = 0;
    static int[] S = new int[1000];
    public static void main(String[] args) throws IOException {
        //Scanner sc = new Scanner(System.in);
        //int N = sc.nextInt();
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        //System.out.println(br.readLine());
        String[] inputChar = br.readLine().split(" ");

        String s;
        int a, b;
        for (int i = 0; i < inputChar.length; i++) {
            s = inputChar[i];
            switch (s){
                case "+":
                    a = pop();
                    b = pop();
                    push(a + b);
                    break;

                case "-":
                    a = pop();
                    b = pop();
                    push(b-a);
                    break;

                case "*":
                    a = pop();
                    b = pop();
                    push(a * b);
                    break;

                default:
                    push(Integer.parseInt(s));
            }
        }

        System.out.println(pop());

    }

    static void push(int x) {
        top++;
        S[top] = x;
    }

    static int pop() {
        top--;
        return S[top + 1];
    }
}
 import java.io.BufferedReader; BufferedReader java.io import java.io.IOException; IOException java.io import java.io.InputStreamReader; InputStreamReader java.io import java.util.*; util.* java public class Main {
    static int top = 0;
    static int[] S = new int[1000];
    public static void main(String[] args) throws IOException {
        //Scanner sc = new Scanner(System.in);
        //int N = sc.nextInt();
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        //System.out.println(br.readLine());
        String[] inputChar = br.readLine().split(" ");

        String s;
        int a, b;
        for (int i = 0; i < inputChar.length; i++) {
            s = inputChar[i];
            switch (s){
                case "+":
                    a = pop();
                    b = pop();
                    push(a + b);
                    break;

                case "-":
                    a = pop();
                    b = pop();
                    push(b-a);
                    break;

                case "*":
                    a = pop();
                    b = pop();
                    push(a * b);
                    break;

                default:
                    push(Integer.parseInt(s));
            }
        }

        System.out.println(pop());

    }

    static void push(int x) {
        top++;
        S[top] = x;
    }

    static int pop() {
        top--;
        return S[top + 1];
    }
} Main static int top = 0; top 0 static int[] S = new int[1000]; S new int[1000] 1000 public static void main(String[] args) throws IOException {
        //Scanner sc = new Scanner(System.in);
        //int N = sc.nextInt();
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        //System.out.println(br.readLine());
        String[] inputChar = br.readLine().split(" ");

        String s;
        int a, b;
        for (int i = 0; i < inputChar.length; i++) {
            s = inputChar[i];
            switch (s){
                case "+":
                    a = pop();
                    b = pop();
                    push(a + b);
                    break;

                case "-":
                    a = pop();
                    b = pop();
                    push(b-a);
                    break;

                case "*":
                    a = pop();
                    b = pop();
                    push(a * b);
                    break;

                default:
                    push(Integer.parseInt(s));
            }
        }

        System.out.println(pop());

    } main {
        //Scanner sc = new Scanner(System.in);
        //int N = sc.nextInt();
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        //System.out.println(br.readLine());
        String[] inputChar = br.readLine().split(" ");

        String s;
        int a, b;
        for (int i = 0; i < inputChar.length; i++) {
            s = inputChar[i];
            switch (s){
                case "+":
                    a = pop();
                    b = pop();
                    push(a + b);
                    break;

                case "-":
                    a = pop();
                    b = pop();
                    push(b-a);
                    break;

                case "*":
                    a = pop();
                    b = pop();
                    push(a * b);
                    break;

                default:
                    push(Integer.parseInt(s));
            }
        }

        System.out.println(pop());

    } BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); br new BufferedReader(new InputStreamReader(System.in)) String[] inputChar = br.readLine().split(" "); inputChar br.readLine().split(" ") br.readLine().split br.readLine() br.readLine br " " String s; s int a a b; b for (int i = 0; i < inputChar.length; i++) {
            s = inputChar[i];
            switch (s){
                case "+":
                    a = pop();
                    b = pop();
                    push(a + b);
                    break;

                case "-":
                    a = pop();
                    b = pop();
                    push(b-a);
                    break;

                case "*":
                    a = pop();
                    b = pop();
                    push(a * b);
                    break;

                default:
                    push(Integer.parseInt(s));
            }
        } int i = 0; int i = 0; i 0 i < inputChar.length i inputChar.length inputChar inputChar.length i++ i++ i {
            s = inputChar[i];
            switch (s){
                case "+":
                    a = pop();
                    b = pop();
                    push(a + b);
                    break;

                case "-":
                    a = pop();
                    b = pop();
                    push(b-a);
                    break;

                case "*":
                    a = pop();
                    b = pop();
                    push(a * b);
                    break;

                default:
                    push(Integer.parseInt(s));
            }
        } {
            s = inputChar[i];
            switch (s){
                case "+":
                    a = pop();
                    b = pop();
                    push(a + b);
                    break;

                case "-":
                    a = pop();
                    b = pop();
                    push(b-a);
                    break;

                case "*":
                    a = pop();
                    b = pop();
                    push(a * b);
                    break;

                default:
                    push(Integer.parseInt(s));
            }
        } s = inputChar[i] s inputChar[i] inputChar i switch (s){
                case "+":
                    a = pop();
                    b = pop();
                    push(a + b);
                    break;

                case "-":
                    a = pop();
                    b = pop();
                    push(b-a);
                    break;

                case "*":
                    a = pop();
                    b = pop();
                    push(a * b);
                    break;

                default:
                    push(Integer.parseInt(s));
            } s case "+": "+" case "+": a = pop() a pop() pop b = pop() b pop() pop push(a + b) push a + b a b break; case "-": "-" case "-": a = pop() a pop() pop b = pop() b pop() pop push(b-a) push b-a b a break; case "*": "*" case "*": a = pop() a pop() pop b = pop() b pop() pop push(a * b) push a * b a b break; default: default: push(Integer.parseInt(s)) push Integer.parseInt(s) Integer.parseInt Integer s System.out.println(pop()) System.out.println System.out System System.out pop() pop String[] args args static void push(int x) {
        top++;
        S[top] = x;
    } push {
        top++;
        S[top] = x;
    } top++ top S[top] = x S[top] S top x int x x static int pop() {
        top--;
        return S[top + 1];
    } pop {
        top--;
        return S[top + 1];
    } top-- top return S[top + 1]; S[top + 1] S top + 1 top 1 public class Main {
    static int top = 0;
    static int[] S = new int[1000];
    public static void main(String[] args) throws IOException {
        //Scanner sc = new Scanner(System.in);
        //int N = sc.nextInt();
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        //System.out.println(br.readLine());
        String[] inputChar = br.readLine().split(" ");

        String s;
        int a, b;
        for (int i = 0; i < inputChar.length; i++) {
            s = inputChar[i];
            switch (s){
                case "+":
                    a = pop();
                    b = pop();
                    push(a + b);
                    break;

                case "-":
                    a = pop();
                    b = pop();
                    push(b-a);
                    break;

                case "*":
                    a = pop();
                    b = pop();
                    push(a * b);
                    break;

                default:
                    push(Integer.parseInt(s));
            }
        }

        System.out.println(pop());

    }

    static void push(int x) {
        top++;
        S[top] = x;
    }

    static int pop() {
        top--;
        return S[top + 1];
    }
} public class Main {
    static int top = 0;
    static int[] S = new int[1000];
    public static void main(String[] args) throws IOException {
        //Scanner sc = new Scanner(System.in);
        //int N = sc.nextInt();
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        //System.out.println(br.readLine());
        String[] inputChar = br.readLine().split(" ");

        String s;
        int a, b;
        for (int i = 0; i < inputChar.length; i++) {
            s = inputChar[i];
            switch (s){
                case "+":
                    a = pop();
                    b = pop();
                    push(a + b);
                    break;

                case "-":
                    a = pop();
                    b = pop();
                    push(b-a);
                    break;

                case "*":
                    a = pop();
                    b = pop();
                    push(a * b);
                    break;

                default:
                    push(Integer.parseInt(s));
            }
        }

        System.out.println(pop());

    }

    static void push(int x) {
        top++;
        S[top] = x;
    }

    static int pop() {
        top--;
        return S[top + 1];
    }
} Main
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.*;

public class Main {
    static int top = 0;
    static int[] S = new int[1000];
    public static void main(String[] args) throws IOException {
        //Scanner sc = new Scanner(System.in);
        //int N = sc.nextInt();
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        //System.out.println(br.readLine());
        String[] inputChar = br.readLine().split(" ");

        String s;
        int a, b;
        for (int i = 0; i < inputChar.length; i++) {
            s = inputChar[i];
            switch (s){
                case "+":
                    a = pop();
                    b = pop();
                    push(a + b);
                    break;

                case "-":
                    a = pop();
                    b = pop();
                    push(b-a);
                    break;

                case "*":
                    a = pop();
                    b = pop();
                    push(a * b);
                    break;

                default:
                    push(Integer.parseInt(s));
            }
        }

        System.out.println(pop());

    }

    static void push(int x) {
        top++;
        S[top] = x;
    }

    static int pop() {
        top--;
        return S[top + 1];
    }
}

