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();
            double num2,num1;
            switch(input)
            {
                case "+":
                    num2 = Double.parseDouble(formula.poll());
                    num1 = Double.parseDouble(formula.poll());
                    formula.push(String.valueOf(num1+num2));
                    break;
                case "-":
                    num2 = Double.parseDouble(formula.poll());
                    num1 = Double.parseDouble(formula.poll());
                    formula.push(String.valueOf(num1-num2));
                    break;
                case "/":
                    num2 = Double.parseDouble(formula.poll());
                    num1 = Double.parseDouble(formula.poll());
                    formula.push(String.valueOf(num1/num2));
                    break;
                case "*":
                    num2 = Double.parseDouble(formula.poll());
                    num1 = Double.parseDouble(formula.poll());
                    formula.push(String.valueOf(num1*num2));
                    break;
                default:
                    formula.push(input);
                    break;
            }
        }
        double ans = Double.parseDouble(formula.poll());
        if(ans==(int)ans)
        {
            System.out.println((int)ans);
        }
        else
        {
            System.out.println(ans);
        }
    }
} 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();
            double num2,num1;
            switch(input)
            {
                case "+":
                    num2 = Double.parseDouble(formula.poll());
                    num1 = Double.parseDouble(formula.poll());
                    formula.push(String.valueOf(num1+num2));
                    break;
                case "-":
                    num2 = Double.parseDouble(formula.poll());
                    num1 = Double.parseDouble(formula.poll());
                    formula.push(String.valueOf(num1-num2));
                    break;
                case "/":
                    num2 = Double.parseDouble(formula.poll());
                    num1 = Double.parseDouble(formula.poll());
                    formula.push(String.valueOf(num1/num2));
                    break;
                case "*":
                    num2 = Double.parseDouble(formula.poll());
                    num1 = Double.parseDouble(formula.poll());
                    formula.push(String.valueOf(num1*num2));
                    break;
                default:
                    formula.push(input);
                    break;
            }
        }
        double ans = Double.parseDouble(formula.poll());
        if(ans==(int)ans)
        {
            System.out.println((int)ans);
        }
        else
        {
            System.out.println(ans);
        }
    }
} 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();
            double num2,num1;
            switch(input)
            {
                case "+":
                    num2 = Double.parseDouble(formula.poll());
                    num1 = Double.parseDouble(formula.poll());
                    formula.push(String.valueOf(num1+num2));
                    break;
                case "-":
                    num2 = Double.parseDouble(formula.poll());
                    num1 = Double.parseDouble(formula.poll());
                    formula.push(String.valueOf(num1-num2));
                    break;
                case "/":
                    num2 = Double.parseDouble(formula.poll());
                    num1 = Double.parseDouble(formula.poll());
                    formula.push(String.valueOf(num1/num2));
                    break;
                case "*":
                    num2 = Double.parseDouble(formula.poll());
                    num1 = Double.parseDouble(formula.poll());
                    formula.push(String.valueOf(num1*num2));
                    break;
                default:
                    formula.push(input);
                    break;
            }
        }
        double ans = Double.parseDouble(formula.poll());
        if(ans==(int)ans)
        {
            System.out.println((int)ans);
        }
        else
        {
            System.out.println(ans);
        }
    } main {
        Deque<String> formula = new ArrayDeque<String>();
        Scanner scan = new Scanner(System.in);

        while(scan.hasNext())
        {
            String input = scan.next();
            double num2,num1;
            switch(input)
            {
                case "+":
                    num2 = Double.parseDouble(formula.poll());
                    num1 = Double.parseDouble(formula.poll());
                    formula.push(String.valueOf(num1+num2));
                    break;
                case "-":
                    num2 = Double.parseDouble(formula.poll());
                    num1 = Double.parseDouble(formula.poll());
                    formula.push(String.valueOf(num1-num2));
                    break;
                case "/":
                    num2 = Double.parseDouble(formula.poll());
                    num1 = Double.parseDouble(formula.poll());
                    formula.push(String.valueOf(num1/num2));
                    break;
                case "*":
                    num2 = Double.parseDouble(formula.poll());
                    num1 = Double.parseDouble(formula.poll());
                    formula.push(String.valueOf(num1*num2));
                    break;
                default:
                    formula.push(input);
                    break;
            }
        }
        double ans = Double.parseDouble(formula.poll());
        if(ans==(int)ans)
        {
            System.out.println((int)ans);
        }
        else
        {
            System.out.println(ans);
        }
    } 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();
            double num2,num1;
            switch(input)
            {
                case "+":
                    num2 = Double.parseDouble(formula.poll());
                    num1 = Double.parseDouble(formula.poll());
                    formula.push(String.valueOf(num1+num2));
                    break;
                case "-":
                    num2 = Double.parseDouble(formula.poll());
                    num1 = Double.parseDouble(formula.poll());
                    formula.push(String.valueOf(num1-num2));
                    break;
                case "/":
                    num2 = Double.parseDouble(formula.poll());
                    num1 = Double.parseDouble(formula.poll());
                    formula.push(String.valueOf(num1/num2));
                    break;
                case "*":
                    num2 = Double.parseDouble(formula.poll());
                    num1 = Double.parseDouble(formula.poll());
                    formula.push(String.valueOf(num1*num2));
                    break;
                default:
                    formula.push(input);
                    break;
            }
        } scan.hasNext() scan.hasNext scan {
            String input = scan.next();
            double num2,num1;
            switch(input)
            {
                case "+":
                    num2 = Double.parseDouble(formula.poll());
                    num1 = Double.parseDouble(formula.poll());
                    formula.push(String.valueOf(num1+num2));
                    break;
                case "-":
                    num2 = Double.parseDouble(formula.poll());
                    num1 = Double.parseDouble(formula.poll());
                    formula.push(String.valueOf(num1-num2));
                    break;
                case "/":
                    num2 = Double.parseDouble(formula.poll());
                    num1 = Double.parseDouble(formula.poll());
                    formula.push(String.valueOf(num1/num2));
                    break;
                case "*":
                    num2 = Double.parseDouble(formula.poll());
                    num1 = Double.parseDouble(formula.poll());
                    formula.push(String.valueOf(num1*num2));
                    break;
                default:
                    formula.push(input);
                    break;
            }
        } String input = scan.next(); input scan.next() scan.next scan double num2 num2 num1; num1 switch(input)
            {
                case "+":
                    num2 = Double.parseDouble(formula.poll());
                    num1 = Double.parseDouble(formula.poll());
                    formula.push(String.valueOf(num1+num2));
                    break;
                case "-":
                    num2 = Double.parseDouble(formula.poll());
                    num1 = Double.parseDouble(formula.poll());
                    formula.push(String.valueOf(num1-num2));
                    break;
                case "/":
                    num2 = Double.parseDouble(formula.poll());
                    num1 = Double.parseDouble(formula.poll());
                    formula.push(String.valueOf(num1/num2));
                    break;
                case "*":
                    num2 = Double.parseDouble(formula.poll());
                    num1 = Double.parseDouble(formula.poll());
                    formula.push(String.valueOf(num1*num2));
                    break;
                default:
                    formula.push(input);
                    break;
            } input case "+": "+" case "+": num2 = Double.parseDouble(formula.poll()) num2 Double.parseDouble(formula.poll()) Double.parseDouble Double formula.poll() formula.poll formula num1 = Double.parseDouble(formula.poll()) num1 Double.parseDouble(formula.poll()) Double.parseDouble Double 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 = Double.parseDouble(formula.poll()) num2 Double.parseDouble(formula.poll()) Double.parseDouble Double formula.poll() formula.poll formula num1 = Double.parseDouble(formula.poll()) num1 Double.parseDouble(formula.poll()) Double.parseDouble Double 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 = Double.parseDouble(formula.poll()) num2 Double.parseDouble(formula.poll()) Double.parseDouble Double formula.poll() formula.poll formula num1 = Double.parseDouble(formula.poll()) num1 Double.parseDouble(formula.poll()) Double.parseDouble Double 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 = Double.parseDouble(formula.poll()) num2 Double.parseDouble(formula.poll()) Double.parseDouble Double formula.poll() formula.poll formula num1 = Double.parseDouble(formula.poll()) num1 Double.parseDouble(formula.poll()) Double.parseDouble Double 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; double ans = Double.parseDouble(formula.poll()); ans Double.parseDouble(formula.poll()) Double.parseDouble Double formula.poll() formula.poll formula if(ans==(int)ans)
        {
            System.out.println((int)ans);
        }
        else
        {
            System.out.println(ans);
        } ans==(int)ans ans (int)ans {
            System.out.println((int)ans);
        } System.out.println((int)ans) System.out.println System.out System System.out (int)ans {
            System.out.println(ans);
        } System.out.println(ans) System.out.println System.out System System.out ans 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();
            double num2,num1;
            switch(input)
            {
                case "+":
                    num2 = Double.parseDouble(formula.poll());
                    num1 = Double.parseDouble(formula.poll());
                    formula.push(String.valueOf(num1+num2));
                    break;
                case "-":
                    num2 = Double.parseDouble(formula.poll());
                    num1 = Double.parseDouble(formula.poll());
                    formula.push(String.valueOf(num1-num2));
                    break;
                case "/":
                    num2 = Double.parseDouble(formula.poll());
                    num1 = Double.parseDouble(formula.poll());
                    formula.push(String.valueOf(num1/num2));
                    break;
                case "*":
                    num2 = Double.parseDouble(formula.poll());
                    num1 = Double.parseDouble(formula.poll());
                    formula.push(String.valueOf(num1*num2));
                    break;
                default:
                    formula.push(input);
                    break;
            }
        }
        double ans = Double.parseDouble(formula.poll());
        if(ans==(int)ans)
        {
            System.out.println((int)ans);
        }
        else
        {
            System.out.println(ans);
        }
    }
} 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();
            double num2,num1;
            switch(input)
            {
                case "+":
                    num2 = Double.parseDouble(formula.poll());
                    num1 = Double.parseDouble(formula.poll());
                    formula.push(String.valueOf(num1+num2));
                    break;
                case "-":
                    num2 = Double.parseDouble(formula.poll());
                    num1 = Double.parseDouble(formula.poll());
                    formula.push(String.valueOf(num1-num2));
                    break;
                case "/":
                    num2 = Double.parseDouble(formula.poll());
                    num1 = Double.parseDouble(formula.poll());
                    formula.push(String.valueOf(num1/num2));
                    break;
                case "*":
                    num2 = Double.parseDouble(formula.poll());
                    num1 = Double.parseDouble(formula.poll());
                    formula.push(String.valueOf(num1*num2));
                    break;
                default:
                    formula.push(input);
                    break;
            }
        }
        double ans = Double.parseDouble(formula.poll());
        if(ans==(int)ans)
        {
            System.out.println((int)ans);
        }
        else
        {
            System.out.println(ans);
        }
    }
} 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();
            double num2,num1;
            switch(input)
            {
                case "+":
                    num2 = Double.parseDouble(formula.poll());
                    num1 = Double.parseDouble(formula.poll());
                    formula.push(String.valueOf(num1+num2));
                    break;
                case "-":
                    num2 = Double.parseDouble(formula.poll());
                    num1 = Double.parseDouble(formula.poll());
                    formula.push(String.valueOf(num1-num2));
                    break;
                case "/":
                    num2 = Double.parseDouble(formula.poll());
                    num1 = Double.parseDouble(formula.poll());
                    formula.push(String.valueOf(num1/num2));
                    break;
                case "*":
                    num2 = Double.parseDouble(formula.poll());
                    num1 = Double.parseDouble(formula.poll());
                    formula.push(String.valueOf(num1*num2));
                    break;
                default:
                    formula.push(input);
                    break;
            }
        }
        double ans = Double.parseDouble(formula.poll());
        if(ans==(int)ans)
        {
            System.out.println((int)ans);
        }
        else
        {
            System.out.println(ans);
        }
    }
}