import java.io.*;

public class Main {

    public static void main(String a[]) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(System.out));
        String[] input = br.readLine().split(" ");
        int[]  stack = new int[input.length];
        int top = -1;
        int op1, op2;
        for (String i : input) {
            switch (i) {
                case "-":
                    op1 = stack[top];
                    stack[top--] = 0;
                    op2 = stack[top];
                    stack[top--] = 0;
                    stack[++top] = op2 - op1 ;
                    break;
                case "+":
                    op1 = stack[top];
                    stack[top--] = 0;
                    op2 = stack[top];
                    stack[top--] = 0;
                    stack[++top] = op2 + op1;
                    break;
                case "/":
                    op1 = stack[top];
                    stack[top--] = 0;
                    op2 = stack[top];
                    stack[top--] = 0;
                    stack[++top] = op2 / op1;
                    break;
                case "*":
                    op1 = stack[top];
                    stack[top--] = 0;
                    op2 = stack[top];
                    stack[top--] = 0;
                    stack[++top] = op2 * op1;
                    break;
                default:
                    stack[++top] = Integer.parseInt(i);
                    break;
            }
        }
        bw.append(stack[0] + "\n");
        bw.flush();
    }

} import java.io.*; io.* java public class Main {

    public static void main(String a[]) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(System.out));
        String[] input = br.readLine().split(" ");
        int[]  stack = new int[input.length];
        int top = -1;
        int op1, op2;
        for (String i : input) {
            switch (i) {
                case "-":
                    op1 = stack[top];
                    stack[top--] = 0;
                    op2 = stack[top];
                    stack[top--] = 0;
                    stack[++top] = op2 - op1 ;
                    break;
                case "+":
                    op1 = stack[top];
                    stack[top--] = 0;
                    op2 = stack[top];
                    stack[top--] = 0;
                    stack[++top] = op2 + op1;
                    break;
                case "/":
                    op1 = stack[top];
                    stack[top--] = 0;
                    op2 = stack[top];
                    stack[top--] = 0;
                    stack[++top] = op2 / op1;
                    break;
                case "*":
                    op1 = stack[top];
                    stack[top--] = 0;
                    op2 = stack[top];
                    stack[top--] = 0;
                    stack[++top] = op2 * op1;
                    break;
                default:
                    stack[++top] = Integer.parseInt(i);
                    break;
            }
        }
        bw.append(stack[0] + "\n");
        bw.flush();
    }

} Main public static void main(String a[]) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(System.out));
        String[] input = br.readLine().split(" ");
        int[]  stack = new int[input.length];
        int top = -1;
        int op1, op2;
        for (String i : input) {
            switch (i) {
                case "-":
                    op1 = stack[top];
                    stack[top--] = 0;
                    op2 = stack[top];
                    stack[top--] = 0;
                    stack[++top] = op2 - op1 ;
                    break;
                case "+":
                    op1 = stack[top];
                    stack[top--] = 0;
                    op2 = stack[top];
                    stack[top--] = 0;
                    stack[++top] = op2 + op1;
                    break;
                case "/":
                    op1 = stack[top];
                    stack[top--] = 0;
                    op2 = stack[top];
                    stack[top--] = 0;
                    stack[++top] = op2 / op1;
                    break;
                case "*":
                    op1 = stack[top];
                    stack[top--] = 0;
                    op2 = stack[top];
                    stack[top--] = 0;
                    stack[++top] = op2 * op1;
                    break;
                default:
                    stack[++top] = Integer.parseInt(i);
                    break;
            }
        }
        bw.append(stack[0] + "\n");
        bw.flush();
    } main {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(System.out));
        String[] input = br.readLine().split(" ");
        int[]  stack = new int[input.length];
        int top = -1;
        int op1, op2;
        for (String i : input) {
            switch (i) {
                case "-":
                    op1 = stack[top];
                    stack[top--] = 0;
                    op2 = stack[top];
                    stack[top--] = 0;
                    stack[++top] = op2 - op1 ;
                    break;
                case "+":
                    op1 = stack[top];
                    stack[top--] = 0;
                    op2 = stack[top];
                    stack[top--] = 0;
                    stack[++top] = op2 + op1;
                    break;
                case "/":
                    op1 = stack[top];
                    stack[top--] = 0;
                    op2 = stack[top];
                    stack[top--] = 0;
                    stack[++top] = op2 / op1;
                    break;
                case "*":
                    op1 = stack[top];
                    stack[top--] = 0;
                    op2 = stack[top];
                    stack[top--] = 0;
                    stack[++top] = op2 * op1;
                    break;
                default:
                    stack[++top] = Integer.parseInt(i);
                    break;
            }
        }
        bw.append(stack[0] + "\n");
        bw.flush();
    } BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); br new BufferedReader(new InputStreamReader(System.in)) BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(System.out)); bw new BufferedWriter(new OutputStreamWriter(System.out)) String[] input = br.readLine().split(" "); input br.readLine().split(" ") br.readLine().split br.readLine() br.readLine br " " int[]  stack = new int[input.length]; stack new int[input.length] input.length input input.length int top = -1; top -1 1 int op1 op1 op2; op2 for (String i : input) {
            switch (i) {
                case "-":
                    op1 = stack[top];
                    stack[top--] = 0;
                    op2 = stack[top];
                    stack[top--] = 0;
                    stack[++top] = op2 - op1 ;
                    break;
                case "+":
                    op1 = stack[top];
                    stack[top--] = 0;
                    op2 = stack[top];
                    stack[top--] = 0;
                    stack[++top] = op2 + op1;
                    break;
                case "/":
                    op1 = stack[top];
                    stack[top--] = 0;
                    op2 = stack[top];
                    stack[top--] = 0;
                    stack[++top] = op2 / op1;
                    break;
                case "*":
                    op1 = stack[top];
                    stack[top--] = 0;
                    op2 = stack[top];
                    stack[top--] = 0;
                    stack[++top] = op2 * op1;
                    break;
                default:
                    stack[++top] = Integer.parseInt(i);
                    break;
            }
        } String i input {
            switch (i) {
                case "-":
                    op1 = stack[top];
                    stack[top--] = 0;
                    op2 = stack[top];
                    stack[top--] = 0;
                    stack[++top] = op2 - op1 ;
                    break;
                case "+":
                    op1 = stack[top];
                    stack[top--] = 0;
                    op2 = stack[top];
                    stack[top--] = 0;
                    stack[++top] = op2 + op1;
                    break;
                case "/":
                    op1 = stack[top];
                    stack[top--] = 0;
                    op2 = stack[top];
                    stack[top--] = 0;
                    stack[++top] = op2 / op1;
                    break;
                case "*":
                    op1 = stack[top];
                    stack[top--] = 0;
                    op2 = stack[top];
                    stack[top--] = 0;
                    stack[++top] = op2 * op1;
                    break;
                default:
                    stack[++top] = Integer.parseInt(i);
                    break;
            }
        } {
            switch (i) {
                case "-":
                    op1 = stack[top];
                    stack[top--] = 0;
                    op2 = stack[top];
                    stack[top--] = 0;
                    stack[++top] = op2 - op1 ;
                    break;
                case "+":
                    op1 = stack[top];
                    stack[top--] = 0;
                    op2 = stack[top];
                    stack[top--] = 0;
                    stack[++top] = op2 + op1;
                    break;
                case "/":
                    op1 = stack[top];
                    stack[top--] = 0;
                    op2 = stack[top];
                    stack[top--] = 0;
                    stack[++top] = op2 / op1;
                    break;
                case "*":
                    op1 = stack[top];
                    stack[top--] = 0;
                    op2 = stack[top];
                    stack[top--] = 0;
                    stack[++top] = op2 * op1;
                    break;
                default:
                    stack[++top] = Integer.parseInt(i);
                    break;
            }
        } switch (i) {
                case "-":
                    op1 = stack[top];
                    stack[top--] = 0;
                    op2 = stack[top];
                    stack[top--] = 0;
                    stack[++top] = op2 - op1 ;
                    break;
                case "+":
                    op1 = stack[top];
                    stack[top--] = 0;
                    op2 = stack[top];
                    stack[top--] = 0;
                    stack[++top] = op2 + op1;
                    break;
                case "/":
                    op1 = stack[top];
                    stack[top--] = 0;
                    op2 = stack[top];
                    stack[top--] = 0;
                    stack[++top] = op2 / op1;
                    break;
                case "*":
                    op1 = stack[top];
                    stack[top--] = 0;
                    op2 = stack[top];
                    stack[top--] = 0;
                    stack[++top] = op2 * op1;
                    break;
                default:
                    stack[++top] = Integer.parseInt(i);
                    break;
            } i case "-": "-" case "-": op1 = stack[top] op1 stack[top] stack top stack[top--] = 0 stack[top--] stack top-- top 0 op2 = stack[top] op2 stack[top] stack top stack[top--] = 0 stack[top--] stack top-- top 0 stack[++top] = op2 - op1 stack[++top] stack ++top top op2 - op1 op2 op1 break; case "+": "+" case "+": op1 = stack[top] op1 stack[top] stack top stack[top--] = 0 stack[top--] stack top-- top 0 op2 = stack[top] op2 stack[top] stack top stack[top--] = 0 stack[top--] stack top-- top 0 stack[++top] = op2 + op1 stack[++top] stack ++top top op2 + op1 op2 op1 break; case "/": "/" case "/": op1 = stack[top] op1 stack[top] stack top stack[top--] = 0 stack[top--] stack top-- top 0 op2 = stack[top] op2 stack[top] stack top stack[top--] = 0 stack[top--] stack top-- top 0 stack[++top] = op2 / op1 stack[++top] stack ++top top op2 / op1 op2 op1 break; case "*": "*" case "*": op1 = stack[top] op1 stack[top] stack top stack[top--] = 0 stack[top--] stack top-- top 0 op2 = stack[top] op2 stack[top] stack top stack[top--] = 0 stack[top--] stack top-- top 0 stack[++top] = op2 * op1 stack[++top] stack ++top top op2 * op1 op2 op1 break; default: default: stack[++top] = Integer.parseInt(i) stack[++top] stack ++top top Integer.parseInt(i) Integer.parseInt Integer i break; bw.append(stack[0] + "\n") bw.append bw stack[0] + "\n" stack[0] stack 0 "\n" bw.flush() bw.flush bw String a[] a public class Main {

    public static void main(String a[]) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(System.out));
        String[] input = br.readLine().split(" ");
        int[]  stack = new int[input.length];
        int top = -1;
        int op1, op2;
        for (String i : input) {
            switch (i) {
                case "-":
                    op1 = stack[top];
                    stack[top--] = 0;
                    op2 = stack[top];
                    stack[top--] = 0;
                    stack[++top] = op2 - op1 ;
                    break;
                case "+":
                    op1 = stack[top];
                    stack[top--] = 0;
                    op2 = stack[top];
                    stack[top--] = 0;
                    stack[++top] = op2 + op1;
                    break;
                case "/":
                    op1 = stack[top];
                    stack[top--] = 0;
                    op2 = stack[top];
                    stack[top--] = 0;
                    stack[++top] = op2 / op1;
                    break;
                case "*":
                    op1 = stack[top];
                    stack[top--] = 0;
                    op2 = stack[top];
                    stack[top--] = 0;
                    stack[++top] = op2 * op1;
                    break;
                default:
                    stack[++top] = Integer.parseInt(i);
                    break;
            }
        }
        bw.append(stack[0] + "\n");
        bw.flush();
    }

} public class Main {

    public static void main(String a[]) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(System.out));
        String[] input = br.readLine().split(" ");
        int[]  stack = new int[input.length];
        int top = -1;
        int op1, op2;
        for (String i : input) {
            switch (i) {
                case "-":
                    op1 = stack[top];
                    stack[top--] = 0;
                    op2 = stack[top];
                    stack[top--] = 0;
                    stack[++top] = op2 - op1 ;
                    break;
                case "+":
                    op1 = stack[top];
                    stack[top--] = 0;
                    op2 = stack[top];
                    stack[top--] = 0;
                    stack[++top] = op2 + op1;
                    break;
                case "/":
                    op1 = stack[top];
                    stack[top--] = 0;
                    op2 = stack[top];
                    stack[top--] = 0;
                    stack[++top] = op2 / op1;
                    break;
                case "*":
                    op1 = stack[top];
                    stack[top--] = 0;
                    op2 = stack[top];
                    stack[top--] = 0;
                    stack[++top] = op2 * op1;
                    break;
                default:
                    stack[++top] = Integer.parseInt(i);
                    break;
            }
        }
        bw.append(stack[0] + "\n");
        bw.flush();
    }

} Main
import java.io.*;

public class Main {

    public static void main(String a[]) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(System.out));
        String[] input = br.readLine().split(" ");
        int[]  stack = new int[input.length];
        int top = -1;
        int op1, op2;
        for (String i : input) {
            switch (i) {
                case "-":
                    op1 = stack[top];
                    stack[top--] = 0;
                    op2 = stack[top];
                    stack[top--] = 0;
                    stack[++top] = op2 - op1 ;
                    break;
                case "+":
                    op1 = stack[top];
                    stack[top--] = 0;
                    op2 = stack[top];
                    stack[top--] = 0;
                    stack[++top] = op2 + op1;
                    break;
                case "/":
                    op1 = stack[top];
                    stack[top--] = 0;
                    op2 = stack[top];
                    stack[top--] = 0;
                    stack[++top] = op2 / op1;
                    break;
                case "*":
                    op1 = stack[top];
                    stack[top--] = 0;
                    op2 = stack[top];
                    stack[top--] = 0;
                    stack[++top] = op2 * op1;
                    break;
                default:
                    stack[++top] = Integer.parseInt(i);
                    break;
            }
        }
        bw.append(stack[0] + "\n");
        bw.flush();
    }

}
