
import java.util.Scanner;
import java.util.Stack;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        Stack<Integer> pila = new Stack<>();
        String[] exp = sc.nextLine().split(" ");
        int oper;
        for (int i = 0; i < exp.length; i++) {
            if (esnumero(exp[i])) {
                pila.push(Integer.parseInt(exp[i]));
            } else {
                switch (exp[i]) {
                    case "+":
                        pila.push(pila.pop() + pila.pop());
                        break;
                    case "-":
                        int a,
                         b;
                        a = pila.pop();
                        b = pila.pop();
                        pila.push(b - a);
                        break;
                    default:
                        pila.push(pila.pop() * pila.pop());
                }
            }
        }
        System.out.println(pila.pop());
    }

    static boolean esnumero(String cadena) {
        try {
            Integer.parseInt(cadena);
            return true;
        } catch (NumberFormatException nfe) {
            return false;
        }
    }
}
 import java.util.Scanner; Scanner java.util import java.util.Stack; Stack java.util public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        Stack<Integer> pila = new Stack<>();
        String[] exp = sc.nextLine().split(" ");
        int oper;
        for (int i = 0; i < exp.length; i++) {
            if (esnumero(exp[i])) {
                pila.push(Integer.parseInt(exp[i]));
            } else {
                switch (exp[i]) {
                    case "+":
                        pila.push(pila.pop() + pila.pop());
                        break;
                    case "-":
                        int a,
                         b;
                        a = pila.pop();
                        b = pila.pop();
                        pila.push(b - a);
                        break;
                    default:
                        pila.push(pila.pop() * pila.pop());
                }
            }
        }
        System.out.println(pila.pop());
    }

    static boolean esnumero(String cadena) {
        try {
            Integer.parseInt(cadena);
            return true;
        } catch (NumberFormatException nfe) {
            return false;
        }
    }
} Main public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        Stack<Integer> pila = new Stack<>();
        String[] exp = sc.nextLine().split(" ");
        int oper;
        for (int i = 0; i < exp.length; i++) {
            if (esnumero(exp[i])) {
                pila.push(Integer.parseInt(exp[i]));
            } else {
                switch (exp[i]) {
                    case "+":
                        pila.push(pila.pop() + pila.pop());
                        break;
                    case "-":
                        int a,
                         b;
                        a = pila.pop();
                        b = pila.pop();
                        pila.push(b - a);
                        break;
                    default:
                        pila.push(pila.pop() * pila.pop());
                }
            }
        }
        System.out.println(pila.pop());
    } main {
        Scanner sc = new Scanner(System.in);
        Stack<Integer> pila = new Stack<>();
        String[] exp = sc.nextLine().split(" ");
        int oper;
        for (int i = 0; i < exp.length; i++) {
            if (esnumero(exp[i])) {
                pila.push(Integer.parseInt(exp[i]));
            } else {
                switch (exp[i]) {
                    case "+":
                        pila.push(pila.pop() + pila.pop());
                        break;
                    case "-":
                        int a,
                         b;
                        a = pila.pop();
                        b = pila.pop();
                        pila.push(b - a);
                        break;
                    default:
                        pila.push(pila.pop() * pila.pop());
                }
            }
        }
        System.out.println(pila.pop());
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) Stack<Integer> pila = new Stack<>(); pila new Stack<>() String[] exp = sc.nextLine().split(" "); exp sc.nextLine().split(" ") sc.nextLine().split sc.nextLine() sc.nextLine sc " " int oper; oper for (int i = 0; i < exp.length; i++) {
            if (esnumero(exp[i])) {
                pila.push(Integer.parseInt(exp[i]));
            } else {
                switch (exp[i]) {
                    case "+":
                        pila.push(pila.pop() + pila.pop());
                        break;
                    case "-":
                        int a,
                         b;
                        a = pila.pop();
                        b = pila.pop();
                        pila.push(b - a);
                        break;
                    default:
                        pila.push(pila.pop() * pila.pop());
                }
            }
        } int i = 0; int i = 0; i 0 i < exp.length i exp.length exp exp.length i++ i++ i {
            if (esnumero(exp[i])) {
                pila.push(Integer.parseInt(exp[i]));
            } else {
                switch (exp[i]) {
                    case "+":
                        pila.push(pila.pop() + pila.pop());
                        break;
                    case "-":
                        int a,
                         b;
                        a = pila.pop();
                        b = pila.pop();
                        pila.push(b - a);
                        break;
                    default:
                        pila.push(pila.pop() * pila.pop());
                }
            }
        } {
            if (esnumero(exp[i])) {
                pila.push(Integer.parseInt(exp[i]));
            } else {
                switch (exp[i]) {
                    case "+":
                        pila.push(pila.pop() + pila.pop());
                        break;
                    case "-":
                        int a,
                         b;
                        a = pila.pop();
                        b = pila.pop();
                        pila.push(b - a);
                        break;
                    default:
                        pila.push(pila.pop() * pila.pop());
                }
            }
        } if (esnumero(exp[i])) {
                pila.push(Integer.parseInt(exp[i]));
            } else {
                switch (exp[i]) {
                    case "+":
                        pila.push(pila.pop() + pila.pop());
                        break;
                    case "-":
                        int a,
                         b;
                        a = pila.pop();
                        b = pila.pop();
                        pila.push(b - a);
                        break;
                    default:
                        pila.push(pila.pop() * pila.pop());
                }
            } esnumero(exp[i]) esnumero exp[i] exp i {
                pila.push(Integer.parseInt(exp[i]));
            } pila.push(Integer.parseInt(exp[i])) pila.push pila Integer.parseInt(exp[i]) Integer.parseInt Integer exp[i] exp i {
                switch (exp[i]) {
                    case "+":
                        pila.push(pila.pop() + pila.pop());
                        break;
                    case "-":
                        int a,
                         b;
                        a = pila.pop();
                        b = pila.pop();
                        pila.push(b - a);
                        break;
                    default:
                        pila.push(pila.pop() * pila.pop());
                }
            } switch (exp[i]) {
                    case "+":
                        pila.push(pila.pop() + pila.pop());
                        break;
                    case "-":
                        int a,
                         b;
                        a = pila.pop();
                        b = pila.pop();
                        pila.push(b - a);
                        break;
                    default:
                        pila.push(pila.pop() * pila.pop());
                } exp[i] exp i case "+": "+" case "+": pila.push(pila.pop() + pila.pop()) pila.push pila pila.pop() + pila.pop() pila.pop() pila.pop pila pila.pop() pila.pop pila break; case "-": "-" case "-": int a a b; b a = pila.pop() a pila.pop() pila.pop pila b = pila.pop() b pila.pop() pila.pop pila pila.push(b - a) pila.push pila b - a b a break; default: default: pila.push(pila.pop() * pila.pop()) pila.push pila pila.pop() * pila.pop() pila.pop() pila.pop pila pila.pop() pila.pop pila System.out.println(pila.pop()) System.out.println System.out System System.out pila.pop() pila.pop pila String[] args args static boolean esnumero(String cadena) {
        try {
            Integer.parseInt(cadena);
            return true;
        } catch (NumberFormatException nfe) {
            return false;
        }
    } esnumero {
        try {
            Integer.parseInt(cadena);
            return true;
        } catch (NumberFormatException nfe) {
            return false;
        }
    } try {
            Integer.parseInt(cadena);
            return true;
        } catch (NumberFormatException nfe) {
            return false;
        } catch (NumberFormatException nfe) {
            return false;
        } NumberFormatException nfe {
            return false;
        } return false; false {
            Integer.parseInt(cadena);
            return true;
        } Integer.parseInt(cadena) Integer.parseInt Integer cadena return true; true String cadena cadena public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        Stack<Integer> pila = new Stack<>();
        String[] exp = sc.nextLine().split(" ");
        int oper;
        for (int i = 0; i < exp.length; i++) {
            if (esnumero(exp[i])) {
                pila.push(Integer.parseInt(exp[i]));
            } else {
                switch (exp[i]) {
                    case "+":
                        pila.push(pila.pop() + pila.pop());
                        break;
                    case "-":
                        int a,
                         b;
                        a = pila.pop();
                        b = pila.pop();
                        pila.push(b - a);
                        break;
                    default:
                        pila.push(pila.pop() * pila.pop());
                }
            }
        }
        System.out.println(pila.pop());
    }

    static boolean esnumero(String cadena) {
        try {
            Integer.parseInt(cadena);
            return true;
        } catch (NumberFormatException nfe) {
            return false;
        }
    }
} public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        Stack<Integer> pila = new Stack<>();
        String[] exp = sc.nextLine().split(" ");
        int oper;
        for (int i = 0; i < exp.length; i++) {
            if (esnumero(exp[i])) {
                pila.push(Integer.parseInt(exp[i]));
            } else {
                switch (exp[i]) {
                    case "+":
                        pila.push(pila.pop() + pila.pop());
                        break;
                    case "-":
                        int a,
                         b;
                        a = pila.pop();
                        b = pila.pop();
                        pila.push(b - a);
                        break;
                    default:
                        pila.push(pila.pop() * pila.pop());
                }
            }
        }
        System.out.println(pila.pop());
    }

    static boolean esnumero(String cadena) {
        try {
            Integer.parseInt(cadena);
            return true;
        } catch (NumberFormatException nfe) {
            return false;
        }
    }
} Main

import java.util.Scanner;
import java.util.Stack;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        Stack<Integer> pila = new Stack<>();
        String[] exp = sc.nextLine().split(" ");
        int oper;
        for (int i = 0; i < exp.length; i++) {
            if (esnumero(exp[i])) {
                pila.push(Integer.parseInt(exp[i]));
            } else {
                switch (exp[i]) {
                    case "+":
                        pila.push(pila.pop() + pila.pop());
                        break;
                    case "-":
                        int a,
                         b;
                        a = pila.pop();
                        b = pila.pop();
                        pila.push(b - a);
                        break;
                    default:
                        pila.push(pila.pop() * pila.pop());
                }
            }
        }
        System.out.println(pila.pop());
    }

    static boolean esnumero(String cadena) {
        try {
            Integer.parseInt(cadena);
            return true;
        } catch (NumberFormatException nfe) {
            return false;
        }
    }
}

