
import java.util.LinkedList;
import java.util.Scanner;

/**
 * Created by sd on 2016/11/22.
 */
public class Main {
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        LinkedList<String> stack = new LinkedList<>();
        while(sc.hasNext()){
            String c = sc.next();

            switch(c){
                case "+":
                case "-":
                case "*":
                    int a = Integer.parseInt(stack.pop()), b = Integer.parseInt(stack.pop());
                    switch(c) {
                        case "+":
                            stack.push(a+b+"");
                            break;
                        case "-":
                            stack.push(-a+b+"");
                            break;
                        case "*":
                            stack.push(a*b+"");
                            break;
                    }
                    break;
                default:
                    stack.push(c);
                    break;
            }
//
//            for(int i=0; i<stack.size(); i++){
//                System.out.print(stack.get(i)+", ");
//            }
//            System.out.println();

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

    }
} import java.util.LinkedList; LinkedList java.util import java.util.Scanner; Scanner java.util public class Main {
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        LinkedList<String> stack = new LinkedList<>();
        while(sc.hasNext()){
            String c = sc.next();

            switch(c){
                case "+":
                case "-":
                case "*":
                    int a = Integer.parseInt(stack.pop()), b = Integer.parseInt(stack.pop());
                    switch(c) {
                        case "+":
                            stack.push(a+b+"");
                            break;
                        case "-":
                            stack.push(-a+b+"");
                            break;
                        case "*":
                            stack.push(a*b+"");
                            break;
                    }
                    break;
                default:
                    stack.push(c);
                    break;
            }
//
//            for(int i=0; i<stack.size(); i++){
//                System.out.print(stack.get(i)+", ");
//            }
//            System.out.println();

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

    }
} Main public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        LinkedList<String> stack = new LinkedList<>();
        while(sc.hasNext()){
            String c = sc.next();

            switch(c){
                case "+":
                case "-":
                case "*":
                    int a = Integer.parseInt(stack.pop()), b = Integer.parseInt(stack.pop());
                    switch(c) {
                        case "+":
                            stack.push(a+b+"");
                            break;
                        case "-":
                            stack.push(-a+b+"");
                            break;
                        case "*":
                            stack.push(a*b+"");
                            break;
                    }
                    break;
                default:
                    stack.push(c);
                    break;
            }
//
//            for(int i=0; i<stack.size(); i++){
//                System.out.print(stack.get(i)+", ");
//            }
//            System.out.println();

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

    } main {
        Scanner sc = new Scanner(System.in);
        LinkedList<String> stack = new LinkedList<>();
        while(sc.hasNext()){
            String c = sc.next();

            switch(c){
                case "+":
                case "-":
                case "*":
                    int a = Integer.parseInt(stack.pop()), b = Integer.parseInt(stack.pop());
                    switch(c) {
                        case "+":
                            stack.push(a+b+"");
                            break;
                        case "-":
                            stack.push(-a+b+"");
                            break;
                        case "*":
                            stack.push(a*b+"");
                            break;
                    }
                    break;
                default:
                    stack.push(c);
                    break;
            }
//
//            for(int i=0; i<stack.size(); i++){
//                System.out.print(stack.get(i)+", ");
//            }
//            System.out.println();

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

    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) LinkedList<String> stack = new LinkedList<>(); stack new LinkedList<>() while(sc.hasNext()){
            String c = sc.next();

            switch(c){
                case "+":
                case "-":
                case "*":
                    int a = Integer.parseInt(stack.pop()), b = Integer.parseInt(stack.pop());
                    switch(c) {
                        case "+":
                            stack.push(a+b+"");
                            break;
                        case "-":
                            stack.push(-a+b+"");
                            break;
                        case "*":
                            stack.push(a*b+"");
                            break;
                    }
                    break;
                default:
                    stack.push(c);
                    break;
            }
//
//            for(int i=0; i<stack.size(); i++){
//                System.out.print(stack.get(i)+", ");
//            }
//            System.out.println();

        } sc.hasNext() sc.hasNext sc {
            String c = sc.next();

            switch(c){
                case "+":
                case "-":
                case "*":
                    int a = Integer.parseInt(stack.pop()), b = Integer.parseInt(stack.pop());
                    switch(c) {
                        case "+":
                            stack.push(a+b+"");
                            break;
                        case "-":
                            stack.push(-a+b+"");
                            break;
                        case "*":
                            stack.push(a*b+"");
                            break;
                    }
                    break;
                default:
                    stack.push(c);
                    break;
            }
//
//            for(int i=0; i<stack.size(); i++){
//                System.out.print(stack.get(i)+", ");
//            }
//            System.out.println();

        } String c = sc.next(); c sc.next() sc.next sc switch(c){
                case "+":
                case "-":
                case "*":
                    int a = Integer.parseInt(stack.pop()), b = Integer.parseInt(stack.pop());
                    switch(c) {
                        case "+":
                            stack.push(a+b+"");
                            break;
                        case "-":
                            stack.push(-a+b+"");
                            break;
                        case "*":
                            stack.push(a*b+"");
                            break;
                    }
                    break;
                default:
                    stack.push(c);
                    break;
            } c case "+": "+" case "+": case "-": "-" case "-": case "*": "*" case "*": int a = Integer.parseInt(stack.pop()) a Integer.parseInt(stack.pop()) Integer.parseInt Integer stack.pop() stack.pop stack b = Integer.parseInt(stack.pop()); b Integer.parseInt(stack.pop()) Integer.parseInt Integer stack.pop() stack.pop stack switch(c) {
                        case "+":
                            stack.push(a+b+"");
                            break;
                        case "-":
                            stack.push(-a+b+"");
                            break;
                        case "*":
                            stack.push(a*b+"");
                            break;
                    } c case "+": "+" case "+": stack.push(a+b+"") stack.push stack a+b+"" a+b+"" a b "" break; case "-": "-" case "-": stack.push(-a+b+"") stack.push stack -a+b+"" -a+b+"" -a a b "" break; case "*": "*" case "*": stack.push(a*b+"") stack.push stack a*b+"" a*b a b "" break; break; default: default: stack.push(c) stack.push stack c break; System.out.println(stack.pop()) System.out.println System.out System System.out stack.pop() stack.pop stack String[] args args public class Main {
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        LinkedList<String> stack = new LinkedList<>();
        while(sc.hasNext()){
            String c = sc.next();

            switch(c){
                case "+":
                case "-":
                case "*":
                    int a = Integer.parseInt(stack.pop()), b = Integer.parseInt(stack.pop());
                    switch(c) {
                        case "+":
                            stack.push(a+b+"");
                            break;
                        case "-":
                            stack.push(-a+b+"");
                            break;
                        case "*":
                            stack.push(a*b+"");
                            break;
                    }
                    break;
                default:
                    stack.push(c);
                    break;
            }
//
//            for(int i=0; i<stack.size(); i++){
//                System.out.print(stack.get(i)+", ");
//            }
//            System.out.println();

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

    }
} public class Main {
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        LinkedList<String> stack = new LinkedList<>();
        while(sc.hasNext()){
            String c = sc.next();

            switch(c){
                case "+":
                case "-":
                case "*":
                    int a = Integer.parseInt(stack.pop()), b = Integer.parseInt(stack.pop());
                    switch(c) {
                        case "+":
                            stack.push(a+b+"");
                            break;
                        case "-":
                            stack.push(-a+b+"");
                            break;
                        case "*":
                            stack.push(a*b+"");
                            break;
                    }
                    break;
                default:
                    stack.push(c);
                    break;
            }
//
//            for(int i=0; i<stack.size(); i++){
//                System.out.print(stack.get(i)+", ");
//            }
//            System.out.println();

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

    }
} Main

import java.util.LinkedList;
import java.util.Scanner;

/**
 * Created by sd on 2016/11/22.
 */
public class Main {
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        LinkedList<String> stack = new LinkedList<>();
        while(sc.hasNext()){
            String c = sc.next();

            switch(c){
                case "+":
                case "-":
                case "*":
                    int a = Integer.parseInt(stack.pop()), b = Integer.parseInt(stack.pop());
                    switch(c) {
                        case "+":
                            stack.push(a+b+"");
                            break;
                        case "-":
                            stack.push(-a+b+"");
                            break;
                        case "*":
                            stack.push(a*b+"");
                            break;
                    }
                    break;
                default:
                    stack.push(c);
                    break;
            }
//
//            for(int i=0; i<stack.size(); i++){
//                System.out.print(stack.get(i)+", ");
//            }
//            System.out.println();

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

    }
}