import java.io.*;

class Main {
    public static void main (String[] args) throws Exception {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        
        String[] exp = br.readLine().split(" ");
        int[] stack = new int[199];
        int top = 0;

        for (int i = 0; i < exp.length; i++) {
            if (exp[i].equals("+")) {
                stack[top - 2] += stack[top - 1];
                top--;
            } else if (exp[i].equals("-")) {
                stack[top - 2] -= stack[top - 1];
                top--;
            } else if (exp[i].equals("*")) {
                stack[top - 2] *= stack[top - 1];
                top--;
            } else {
                stack[top] = Integer.parseInt(exp[i]);
                top++;
            }
        }

        System.out.println(stack[0]);
    }
} import java.io.*; io.* java class Main {
    public static void main (String[] args) throws Exception {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        
        String[] exp = br.readLine().split(" ");
        int[] stack = new int[199];
        int top = 0;

        for (int i = 0; i < exp.length; i++) {
            if (exp[i].equals("+")) {
                stack[top - 2] += stack[top - 1];
                top--;
            } else if (exp[i].equals("-")) {
                stack[top - 2] -= stack[top - 1];
                top--;
            } else if (exp[i].equals("*")) {
                stack[top - 2] *= stack[top - 1];
                top--;
            } else {
                stack[top] = Integer.parseInt(exp[i]);
                top++;
            }
        }

        System.out.println(stack[0]);
    }
} Main public static void main (String[] args) throws Exception {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        
        String[] exp = br.readLine().split(" ");
        int[] stack = new int[199];
        int top = 0;

        for (int i = 0; i < exp.length; i++) {
            if (exp[i].equals("+")) {
                stack[top - 2] += stack[top - 1];
                top--;
            } else if (exp[i].equals("-")) {
                stack[top - 2] -= stack[top - 1];
                top--;
            } else if (exp[i].equals("*")) {
                stack[top - 2] *= stack[top - 1];
                top--;
            } else {
                stack[top] = Integer.parseInt(exp[i]);
                top++;
            }
        }

        System.out.println(stack[0]);
    } main {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        
        String[] exp = br.readLine().split(" ");
        int[] stack = new int[199];
        int top = 0;

        for (int i = 0; i < exp.length; i++) {
            if (exp[i].equals("+")) {
                stack[top - 2] += stack[top - 1];
                top--;
            } else if (exp[i].equals("-")) {
                stack[top - 2] -= stack[top - 1];
                top--;
            } else if (exp[i].equals("*")) {
                stack[top - 2] *= stack[top - 1];
                top--;
            } else {
                stack[top] = Integer.parseInt(exp[i]);
                top++;
            }
        }

        System.out.println(stack[0]);
    } BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); br new BufferedReader(new InputStreamReader(System.in)) String[] exp = br.readLine().split(" "); exp br.readLine().split(" ") br.readLine().split br.readLine() br.readLine br " " int[] stack = new int[199]; stack new int[199] 199 int top = 0; top 0 for (int i = 0; i < exp.length; i++) {
            if (exp[i].equals("+")) {
                stack[top - 2] += stack[top - 1];
                top--;
            } else if (exp[i].equals("-")) {
                stack[top - 2] -= stack[top - 1];
                top--;
            } else if (exp[i].equals("*")) {
                stack[top - 2] *= stack[top - 1];
                top--;
            } else {
                stack[top] = Integer.parseInt(exp[i]);
                top++;
            }
        } int i = 0; int i = 0; i 0 i < exp.length i exp.length exp exp.length i++ i++ i {
            if (exp[i].equals("+")) {
                stack[top - 2] += stack[top - 1];
                top--;
            } else if (exp[i].equals("-")) {
                stack[top - 2] -= stack[top - 1];
                top--;
            } else if (exp[i].equals("*")) {
                stack[top - 2] *= stack[top - 1];
                top--;
            } else {
                stack[top] = Integer.parseInt(exp[i]);
                top++;
            }
        } {
            if (exp[i].equals("+")) {
                stack[top - 2] += stack[top - 1];
                top--;
            } else if (exp[i].equals("-")) {
                stack[top - 2] -= stack[top - 1];
                top--;
            } else if (exp[i].equals("*")) {
                stack[top - 2] *= stack[top - 1];
                top--;
            } else {
                stack[top] = Integer.parseInt(exp[i]);
                top++;
            }
        } if (exp[i].equals("+")) {
                stack[top - 2] += stack[top - 1];
                top--;
            } else if (exp[i].equals("-")) {
                stack[top - 2] -= stack[top - 1];
                top--;
            } else if (exp[i].equals("*")) {
                stack[top - 2] *= stack[top - 1];
                top--;
            } else {
                stack[top] = Integer.parseInt(exp[i]);
                top++;
            } exp[i].equals("+") exp[i].equals exp[i] exp i "+" {
                stack[top - 2] += stack[top - 1];
                top--;
            } stack[top - 2] += stack[top - 1] stack[top - 2] stack top - 2 top 2 stack[top - 1] stack top - 1 top 1 top-- top if (exp[i].equals("-")) {
                stack[top - 2] -= stack[top - 1];
                top--;
            } else if (exp[i].equals("*")) {
                stack[top - 2] *= stack[top - 1];
                top--;
            } else {
                stack[top] = Integer.parseInt(exp[i]);
                top++;
            } exp[i].equals("-") exp[i].equals exp[i] exp i "-" {
                stack[top - 2] -= stack[top - 1];
                top--;
            } stack[top - 2] -= stack[top - 1] stack[top - 2] stack top - 2 top 2 stack[top - 1] stack top - 1 top 1 top-- top if (exp[i].equals("*")) {
                stack[top - 2] *= stack[top - 1];
                top--;
            } else {
                stack[top] = Integer.parseInt(exp[i]);
                top++;
            } exp[i].equals("*") exp[i].equals exp[i] exp i "*" {
                stack[top - 2] *= stack[top - 1];
                top--;
            } stack[top - 2] *= stack[top - 1] stack[top - 2] stack top - 2 top 2 stack[top - 1] stack top - 1 top 1 top-- top {
                stack[top] = Integer.parseInt(exp[i]);
                top++;
            } stack[top] = Integer.parseInt(exp[i]) stack[top] stack top Integer.parseInt(exp[i]) Integer.parseInt Integer exp[i] exp i top++ top System.out.println(stack[0]) System.out.println System.out System System.out stack[0] stack 0 String[] args args
import java.io.*;

class Main {
    public static void main (String[] args) throws Exception {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        
        String[] exp = br.readLine().split(" ");
        int[] stack = new int[199];
        int top = 0;

        for (int i = 0; i < exp.length; i++) {
            if (exp[i].equals("+")) {
                stack[top - 2] += stack[top - 1];
                top--;
            } else if (exp[i].equals("-")) {
                stack[top - 2] -= stack[top - 1];
                top--;
            } else if (exp[i].equals("*")) {
                stack[top - 2] *= stack[top - 1];
                top--;
            } else {
                stack[top] = Integer.parseInt(exp[i]);
                top++;
            }
        }

        System.out.println(stack[0]);
    }
}