import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.Stack;

public class Main {

    public static void main(String[] args) throws Exception {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String[] array = br.readLine().split(" ");

        Stack<Integer> stack = new Stack<>();

        for (String s : array) {
            if (isOperator(s)) {
                int a = stack.pop();
                int b = stack.pop();
                int c = calculate(b, a, s);
                stack.push(c);
            } else {
                stack.push(Integer.parseInt(s));
            }
        }

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

    private static boolean isOperator(String s) {
        switch (s) {
            case "+":
            case "-":
            case "*":
            case "/":
                return true;
            default:
                return false;
        }
    }

    private static int calculate(int a, int b, String op) {
        switch (op) {
            case "+":
                return a + b;
            case "-":
                return a - b;
            case "*":
                return a * b;
            case "/":
                return a / b;
            default:
                return 0;
        }
    }
} import java.io.BufferedReader; BufferedReader java.io import java.io.InputStreamReader; InputStreamReader java.io import java.util.Stack; Stack java.util public class Main {

    public static void main(String[] args) throws Exception {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String[] array = br.readLine().split(" ");

        Stack<Integer> stack = new Stack<>();

        for (String s : array) {
            if (isOperator(s)) {
                int a = stack.pop();
                int b = stack.pop();
                int c = calculate(b, a, s);
                stack.push(c);
            } else {
                stack.push(Integer.parseInt(s));
            }
        }

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

    private static boolean isOperator(String s) {
        switch (s) {
            case "+":
            case "-":
            case "*":
            case "/":
                return true;
            default:
                return false;
        }
    }

    private static int calculate(int a, int b, String op) {
        switch (op) {
            case "+":
                return a + b;
            case "-":
                return a - b;
            case "*":
                return a * b;
            case "/":
                return a / b;
            default:
                return 0;
        }
    }
} Main public static void main(String[] args) throws Exception {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String[] array = br.readLine().split(" ");

        Stack<Integer> stack = new Stack<>();

        for (String s : array) {
            if (isOperator(s)) {
                int a = stack.pop();
                int b = stack.pop();
                int c = calculate(b, a, s);
                stack.push(c);
            } else {
                stack.push(Integer.parseInt(s));
            }
        }

        System.out.println(stack.pop());
    } main {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String[] array = br.readLine().split(" ");

        Stack<Integer> stack = new Stack<>();

        for (String s : array) {
            if (isOperator(s)) {
                int a = stack.pop();
                int b = stack.pop();
                int c = calculate(b, a, s);
                stack.push(c);
            } else {
                stack.push(Integer.parseInt(s));
            }
        }

        System.out.println(stack.pop());
    } BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); br new BufferedReader(new InputStreamReader(System.in)) String[] array = br.readLine().split(" "); array br.readLine().split(" ") br.readLine().split br.readLine() br.readLine br " " Stack<Integer> stack = new Stack<>(); stack new Stack<>() for (String s : array) {
            if (isOperator(s)) {
                int a = stack.pop();
                int b = stack.pop();
                int c = calculate(b, a, s);
                stack.push(c);
            } else {
                stack.push(Integer.parseInt(s));
            }
        } String s array {
            if (isOperator(s)) {
                int a = stack.pop();
                int b = stack.pop();
                int c = calculate(b, a, s);
                stack.push(c);
            } else {
                stack.push(Integer.parseInt(s));
            }
        } {
            if (isOperator(s)) {
                int a = stack.pop();
                int b = stack.pop();
                int c = calculate(b, a, s);
                stack.push(c);
            } else {
                stack.push(Integer.parseInt(s));
            }
        } if (isOperator(s)) {
                int a = stack.pop();
                int b = stack.pop();
                int c = calculate(b, a, s);
                stack.push(c);
            } else {
                stack.push(Integer.parseInt(s));
            } isOperator(s) isOperator s {
                int a = stack.pop();
                int b = stack.pop();
                int c = calculate(b, a, s);
                stack.push(c);
            } int a = stack.pop(); a stack.pop() stack.pop stack int b = stack.pop(); b stack.pop() stack.pop stack int c = calculate(b, a, s); c calculate(b, a, s) calculate b a s stack.push(c) stack.push stack c {
                stack.push(Integer.parseInt(s));
            } stack.push(Integer.parseInt(s)) stack.push stack Integer.parseInt(s) Integer.parseInt Integer s System.out.println(stack.pop()) System.out.println System.out System System.out stack.pop() stack.pop stack String[] args args private static boolean isOperator(String s) {
        switch (s) {
            case "+":
            case "-":
            case "*":
            case "/":
                return true;
            default:
                return false;
        }
    } isOperator {
        switch (s) {
            case "+":
            case "-":
            case "*":
            case "/":
                return true;
            default:
                return false;
        }
    } switch (s) {
            case "+":
            case "-":
            case "*":
            case "/":
                return true;
            default:
                return false;
        } s case "+": "+" case "+": case "-": "-" case "-": case "*": "*" case "*": case "/": "/" case "/": return true; true default: default: return false; false String s s private static int calculate(int a, int b, String op) {
        switch (op) {
            case "+":
                return a + b;
            case "-":
                return a - b;
            case "*":
                return a * b;
            case "/":
                return a / b;
            default:
                return 0;
        }
    } calculate {
        switch (op) {
            case "+":
                return a + b;
            case "-":
                return a - b;
            case "*":
                return a * b;
            case "/":
                return a / b;
            default:
                return 0;
        }
    } switch (op) {
            case "+":
                return a + b;
            case "-":
                return a - b;
            case "*":
                return a * b;
            case "/":
                return a / b;
            default:
                return 0;
        } op case "+": "+" case "+": return a + b; a + b a b case "-": "-" case "-": return a - b; a - b a b case "*": "*" case "*": return a * b; a * b a b case "/": "/" case "/": return a / b; a / b a b default: default: return 0; 0 int a a int b b String op op public class Main {

    public static void main(String[] args) throws Exception {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String[] array = br.readLine().split(" ");

        Stack<Integer> stack = new Stack<>();

        for (String s : array) {
            if (isOperator(s)) {
                int a = stack.pop();
                int b = stack.pop();
                int c = calculate(b, a, s);
                stack.push(c);
            } else {
                stack.push(Integer.parseInt(s));
            }
        }

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

    private static boolean isOperator(String s) {
        switch (s) {
            case "+":
            case "-":
            case "*":
            case "/":
                return true;
            default:
                return false;
        }
    }

    private static int calculate(int a, int b, String op) {
        switch (op) {
            case "+":
                return a + b;
            case "-":
                return a - b;
            case "*":
                return a * b;
            case "/":
                return a / b;
            default:
                return 0;
        }
    }
} public class Main {

    public static void main(String[] args) throws Exception {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String[] array = br.readLine().split(" ");

        Stack<Integer> stack = new Stack<>();

        for (String s : array) {
            if (isOperator(s)) {
                int a = stack.pop();
                int b = stack.pop();
                int c = calculate(b, a, s);
                stack.push(c);
            } else {
                stack.push(Integer.parseInt(s));
            }
        }

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

    private static boolean isOperator(String s) {
        switch (s) {
            case "+":
            case "-":
            case "*":
            case "/":
                return true;
            default:
                return false;
        }
    }

    private static int calculate(int a, int b, String op) {
        switch (op) {
            case "+":
                return a + b;
            case "-":
                return a - b;
            case "*":
                return a * b;
            case "/":
                return a / b;
            default:
                return 0;
        }
    }
} Main
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.Stack;

public class Main {

    public static void main(String[] args) throws Exception {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String[] array = br.readLine().split(" ");

        Stack<Integer> stack = new Stack<>();

        for (String s : array) {
            if (isOperator(s)) {
                int a = stack.pop();
                int b = stack.pop();
                int c = calculate(b, a, s);
                stack.push(c);
            } else {
                stack.push(Integer.parseInt(s));
            }
        }

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

    private static boolean isOperator(String s) {
        switch (s) {
            case "+":
            case "-":
            case "*":
            case "/":
                return true;
            default:
                return false;
        }
    }

    private static int calculate(int a, int b, String op) {
        switch (op) {
            case "+":
                return a + b;
            case "-":
                return a - b;
            case "*":
                return a * b;
            case "/":
                return a / b;
            default:
                return 0;
        }
    }
}