import java.io.*;
import java.util.*;

public class Main
{
    public static void main(String[] args)
    {
        Deque<String> formula = new ArrayDeque<String>();
        Scanner scan = new Scanner(System.in);

        while(scan.hasNext())
        {
            String input = scan.next();
            int num2,num1;
            switch(input)
            {
                case "+":
                    num2 = Integer.parseInt(formula.poll());
                    num1 = Integer.parseInt(formula.poll());
                    formula.push(String.valueOf(num1+num2));
                    break;
                case "-":
                    num2 = Integer.parseInt(formula.poll());
                    num1 = Integer.parseInt(formula.poll());
                    formula.push(String.valueOf(num1-num2));
                    break;
                case "*":
                    num2 = Integer.parseInt(formula.poll());
                    num1 = Integer.parseInt(formula.poll());
                    formula.push(String.valueOf(num1*num2));
                    break;
                default:
                    formula.push(input);
                    break;
            }
        }
        System.out.println(formula.poll());
    }
} import java.io.*; io.* java import java.util.*; util.* java public class Main
{
    public static void main(String[] args)
    {
        Deque<String> formula = new ArrayDeque<String>();
        Scanner scan = new Scanner(System.in);

        while(scan.hasNext())
        {
            String input = scan.next();
            int num2,num1;
            switch(input)
            {
                case "+":
                    num2 = Integer.parseInt(formula.poll());
                    num1 = Integer.parseInt(formula.poll());
                    formula.push(String.valueOf(num1+num2));
                    break;
                case "-":
                    num2 = Integer.parseInt(formula.poll());
                    num1 = Integer.parseInt(formula.poll());
                    formula.push(String.valueOf(num1-num2));
                    break;
                case "*":
                    num2 = Integer.parseInt(formula.poll());
                    num1 = Integer.parseInt(formula.poll());
                    formula.push(String.valueOf(num1*num2));
                    break;
                default:
                    formula.push(input);
                    break;
            }
        }
        System.out.println(formula.poll());
    }
} Main public static void main(String[] args)
    {
        Deque<String> formula = new ArrayDeque<String>();
        Scanner scan = new Scanner(System.in);

        while(scan.hasNext())
        {
            String input = scan.next();
            int num2,num1;
            switch(input)
            {
                case "+":
                    num2 = Integer.parseInt(formula.poll());
                    num1 = Integer.parseInt(formula.poll());
                    formula.push(String.valueOf(num1+num2));
                    break;
                case "-":
                    num2 = Integer.parseInt(formula.poll());
                    num1 = Integer.parseInt(formula.poll());
                    formula.push(String.valueOf(num1-num2));
                    break;
                case "*":
                    num2 = Integer.parseInt(formula.poll());
                    num1 = Integer.parseInt(formula.poll());
                    formula.push(String.valueOf(num1*num2));
                    break;
                default:
                    formula.push(input);
                    break;
            }
        }
        System.out.println(formula.poll());
    } main {
        Deque<String> formula = new ArrayDeque<String>();
        Scanner scan = new Scanner(System.in);

        while(scan.hasNext())
        {
            String input = scan.next();
            int num2,num1;
            switch(input)
            {
                case "+":
                    num2 = Integer.parseInt(formula.poll());
                    num1 = Integer.parseInt(formula.poll());
                    formula.push(String.valueOf(num1+num2));
                    break;
                case "-":
                    num2 = Integer.parseInt(formula.poll());
                    num1 = Integer.parseInt(formula.poll());
                    formula.push(String.valueOf(num1-num2));
                    break;
                case "*":
                    num2 = Integer.parseInt(formula.poll());
                    num1 = Integer.parseInt(formula.poll());
                    formula.push(String.valueOf(num1*num2));
                    break;
                default:
                    formula.push(input);
                    break;
            }
        }
        System.out.println(formula.poll());
    } Deque<String> formula = new ArrayDeque<String>(); formula new ArrayDeque<String>() Scanner scan = new Scanner(System.in); scan new Scanner(System.in) while(scan.hasNext())
        {
            String input = scan.next();
            int num2,num1;
            switch(input)
            {
                case "+":
                    num2 = Integer.parseInt(formula.poll());
                    num1 = Integer.parseInt(formula.poll());
                    formula.push(String.valueOf(num1+num2));
                    break;
                case "-":
                    num2 = Integer.parseInt(formula.poll());
                    num1 = Integer.parseInt(formula.poll());
                    formula.push(String.valueOf(num1-num2));
                    break;
                case "*":
                    num2 = Integer.parseInt(formula.poll());
                    num1 = Integer.parseInt(formula.poll());
                    formula.push(String.valueOf(num1*num2));
                    break;
                default:
                    formula.push(input);
                    break;
            }
        } scan.hasNext() scan.hasNext scan {
            String input = scan.next();
            int num2,num1;
            switch(input)
            {
                case "+":
                    num2 = Integer.parseInt(formula.poll());
                    num1 = Integer.parseInt(formula.poll());
                    formula.push(String.valueOf(num1+num2));
                    break;
                case "-":
                    num2 = Integer.parseInt(formula.poll());
                    num1 = Integer.parseInt(formula.poll());
                    formula.push(String.valueOf(num1-num2));
                    break;
                case "*":
                    num2 = Integer.parseInt(formula.poll());
                    num1 = Integer.parseInt(formula.poll());
                    formula.push(String.valueOf(num1*num2));
                    break;
                default:
                    formula.push(input);
                    break;
            }
        } String input = scan.next(); input scan.next() scan.next scan int num2 num2 num1; num1 switch(input)
            {
                case "+":
                    num2 = Integer.parseInt(formula.poll());
                    num1 = Integer.parseInt(formula.poll());
                    formula.push(String.valueOf(num1+num2));
                    break;
                case "-":
                    num2 = Integer.parseInt(formula.poll());
                    num1 = Integer.parseInt(formula.poll());
                    formula.push(String.valueOf(num1-num2));
                    break;
                case "*":
                    num2 = Integer.parseInt(formula.poll());
                    num1 = Integer.parseInt(formula.poll());
                    formula.push(String.valueOf(num1*num2));
                    break;
                default:
                    formula.push(input);
                    break;
            } input case "+": "+" case "+": num2 = Integer.parseInt(formula.poll()) num2 Integer.parseInt(formula.poll()) Integer.parseInt Integer formula.poll() formula.poll formula num1 = Integer.parseInt(formula.poll()) num1 Integer.parseInt(formula.poll()) Integer.parseInt Integer formula.poll() formula.poll formula formula.push(String.valueOf(num1+num2)) formula.push formula String.valueOf(num1+num2) String.valueOf String num1+num2 num1 num2 break; case "-": "-" case "-": num2 = Integer.parseInt(formula.poll()) num2 Integer.parseInt(formula.poll()) Integer.parseInt Integer formula.poll() formula.poll formula num1 = Integer.parseInt(formula.poll()) num1 Integer.parseInt(formula.poll()) Integer.parseInt Integer formula.poll() formula.poll formula formula.push(String.valueOf(num1-num2)) formula.push formula String.valueOf(num1-num2) String.valueOf String num1-num2 num1 num2 break; case "*": "*" case "*": num2 = Integer.parseInt(formula.poll()) num2 Integer.parseInt(formula.poll()) Integer.parseInt Integer formula.poll() formula.poll formula num1 = Integer.parseInt(formula.poll()) num1 Integer.parseInt(formula.poll()) Integer.parseInt Integer formula.poll() formula.poll formula formula.push(String.valueOf(num1*num2)) formula.push formula String.valueOf(num1*num2) String.valueOf String num1*num2 num1 num2 break; default: default: formula.push(input) formula.push formula input break; System.out.println(formula.poll()) System.out.println System.out System System.out formula.poll() formula.poll formula String[] args args public class Main
{
    public static void main(String[] args)
    {
        Deque<String> formula = new ArrayDeque<String>();
        Scanner scan = new Scanner(System.in);

        while(scan.hasNext())
        {
            String input = scan.next();
            int num2,num1;
            switch(input)
            {
                case "+":
                    num2 = Integer.parseInt(formula.poll());
                    num1 = Integer.parseInt(formula.poll());
                    formula.push(String.valueOf(num1+num2));
                    break;
                case "-":
                    num2 = Integer.parseInt(formula.poll());
                    num1 = Integer.parseInt(formula.poll());
                    formula.push(String.valueOf(num1-num2));
                    break;
                case "*":
                    num2 = Integer.parseInt(formula.poll());
                    num1 = Integer.parseInt(formula.poll());
                    formula.push(String.valueOf(num1*num2));
                    break;
                default:
                    formula.push(input);
                    break;
            }
        }
        System.out.println(formula.poll());
    }
} public class Main
{
    public static void main(String[] args)
    {
        Deque<String> formula = new ArrayDeque<String>();
        Scanner scan = new Scanner(System.in);

        while(scan.hasNext())
        {
            String input = scan.next();
            int num2,num1;
            switch(input)
            {
                case "+":
                    num2 = Integer.parseInt(formula.poll());
                    num1 = Integer.parseInt(formula.poll());
                    formula.push(String.valueOf(num1+num2));
                    break;
                case "-":
                    num2 = Integer.parseInt(formula.poll());
                    num1 = Integer.parseInt(formula.poll());
                    formula.push(String.valueOf(num1-num2));
                    break;
                case "*":
                    num2 = Integer.parseInt(formula.poll());
                    num1 = Integer.parseInt(formula.poll());
                    formula.push(String.valueOf(num1*num2));
                    break;
                default:
                    formula.push(input);
                    break;
            }
        }
        System.out.println(formula.poll());
    }
} Main
import java.io.*;
import java.util.*;

public class Main
{
    public static void main(String[] args)
    {
        Deque<String> formula = new ArrayDeque<String>();
        Scanner scan = new Scanner(System.in);

        while(scan.hasNext())
        {
            String input = scan.next();
            int num2,num1;
            switch(input)
            {
                case "+":
                    num2 = Integer.parseInt(formula.poll());
                    num1 = Integer.parseInt(formula.poll());
                    formula.push(String.valueOf(num1+num2));
                    break;
                case "-":
                    num2 = Integer.parseInt(formula.poll());
                    num1 = Integer.parseInt(formula.poll());
                    formula.push(String.valueOf(num1-num2));
                    break;
                case "*":
                    num2 = Integer.parseInt(formula.poll());
                    num1 = Integer.parseInt(formula.poll());
                    formula.push(String.valueOf(num1*num2));
                    break;
                default:
                    formula.push(input);
                    break;
            }
        }
        System.out.println(formula.poll());
    }
}