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

public class Main
{
    public static void main(String[] args)
    {
        Scanner scan = new Scanner(System.in);
        Stack<String> stack = new Stack<String>();
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

        String line = "";
        try
        {
            line = br.readLine();
        }
        catch (IOException e)
        {
            e.printStackTrace();
        }

        String[] s = line.split(" ");

        for (int i = 0; i < s.length; i++)
        {
            if ("+".equals(s[i]))
            {
                int op1 = Integer.parseInt(stack.pop());
                int op2 = Integer.parseInt(stack.pop());
                stack.push(Integer.toString((op1 + op2)));
            }
            else if ("-".equals(s[i]))
            {
                int op1 = Integer.parseInt(stack.pop());
                int op2 = Integer.parseInt(stack.pop());
                stack.push(Integer.toString((op2 - op1)));
            }
            else if ("*".equals(s[i]))
            {
                int op1 = Integer.parseInt(stack.pop());
                int op2 = Integer.parseInt(stack.pop());
                stack.push(Integer.toString((op1 * op2)));
            }
            else
            {
                stack.push(s[i]);
            }
        }

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

} import java.io.BufferedReader; BufferedReader java.io import java.io.IOException; IOException java.io import java.io.InputStreamReader; InputStreamReader java.io import java.util.Scanner; Scanner java.util import java.util.Stack; Stack java.util public class Main
{
    public static void main(String[] args)
    {
        Scanner scan = new Scanner(System.in);
        Stack<String> stack = new Stack<String>();
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

        String line = "";
        try
        {
            line = br.readLine();
        }
        catch (IOException e)
        {
            e.printStackTrace();
        }

        String[] s = line.split(" ");

        for (int i = 0; i < s.length; i++)
        {
            if ("+".equals(s[i]))
            {
                int op1 = Integer.parseInt(stack.pop());
                int op2 = Integer.parseInt(stack.pop());
                stack.push(Integer.toString((op1 + op2)));
            }
            else if ("-".equals(s[i]))
            {
                int op1 = Integer.parseInt(stack.pop());
                int op2 = Integer.parseInt(stack.pop());
                stack.push(Integer.toString((op2 - op1)));
            }
            else if ("*".equals(s[i]))
            {
                int op1 = Integer.parseInt(stack.pop());
                int op2 = Integer.parseInt(stack.pop());
                stack.push(Integer.toString((op1 * op2)));
            }
            else
            {
                stack.push(s[i]);
            }
        }

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

} Main public static void main(String[] args)
    {
        Scanner scan = new Scanner(System.in);
        Stack<String> stack = new Stack<String>();
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

        String line = "";
        try
        {
            line = br.readLine();
        }
        catch (IOException e)
        {
            e.printStackTrace();
        }

        String[] s = line.split(" ");

        for (int i = 0; i < s.length; i++)
        {
            if ("+".equals(s[i]))
            {
                int op1 = Integer.parseInt(stack.pop());
                int op2 = Integer.parseInt(stack.pop());
                stack.push(Integer.toString((op1 + op2)));
            }
            else if ("-".equals(s[i]))
            {
                int op1 = Integer.parseInt(stack.pop());
                int op2 = Integer.parseInt(stack.pop());
                stack.push(Integer.toString((op2 - op1)));
            }
            else if ("*".equals(s[i]))
            {
                int op1 = Integer.parseInt(stack.pop());
                int op2 = Integer.parseInt(stack.pop());
                stack.push(Integer.toString((op1 * op2)));
            }
            else
            {
                stack.push(s[i]);
            }
        }

        System.out.println(stack.pop());
        scan.close();
    } main {
        Scanner scan = new Scanner(System.in);
        Stack<String> stack = new Stack<String>();
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

        String line = "";
        try
        {
            line = br.readLine();
        }
        catch (IOException e)
        {
            e.printStackTrace();
        }

        String[] s = line.split(" ");

        for (int i = 0; i < s.length; i++)
        {
            if ("+".equals(s[i]))
            {
                int op1 = Integer.parseInt(stack.pop());
                int op2 = Integer.parseInt(stack.pop());
                stack.push(Integer.toString((op1 + op2)));
            }
            else if ("-".equals(s[i]))
            {
                int op1 = Integer.parseInt(stack.pop());
                int op2 = Integer.parseInt(stack.pop());
                stack.push(Integer.toString((op2 - op1)));
            }
            else if ("*".equals(s[i]))
            {
                int op1 = Integer.parseInt(stack.pop());
                int op2 = Integer.parseInt(stack.pop());
                stack.push(Integer.toString((op1 * op2)));
            }
            else
            {
                stack.push(s[i]);
            }
        }

        System.out.println(stack.pop());
        scan.close();
    } Scanner scan = new Scanner(System.in); scan new Scanner(System.in) Stack<String> stack = new Stack<String>(); stack new Stack<String>() BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); br new BufferedReader(new InputStreamReader(System.in)) String line = ""; line "" try
        {
            line = br.readLine();
        }
        catch (IOException e)
        {
            e.printStackTrace();
        } catch (IOException e)
        {
            e.printStackTrace();
        } IOException e {
            e.printStackTrace();
        } e.printStackTrace() e.printStackTrace e {
            line = br.readLine();
        } line = br.readLine() line br.readLine() br.readLine br String[] s = line.split(" "); s line.split(" ") line.split line " " for (int i = 0; i < s.length; i++)
        {
            if ("+".equals(s[i]))
            {
                int op1 = Integer.parseInt(stack.pop());
                int op2 = Integer.parseInt(stack.pop());
                stack.push(Integer.toString((op1 + op2)));
            }
            else if ("-".equals(s[i]))
            {
                int op1 = Integer.parseInt(stack.pop());
                int op2 = Integer.parseInt(stack.pop());
                stack.push(Integer.toString((op2 - op1)));
            }
            else if ("*".equals(s[i]))
            {
                int op1 = Integer.parseInt(stack.pop());
                int op2 = Integer.parseInt(stack.pop());
                stack.push(Integer.toString((op1 * op2)));
            }
            else
            {
                stack.push(s[i]);
            }
        } int i = 0; int i = 0; i 0 i < s.length i s.length s s.length i++ i++ i {
            if ("+".equals(s[i]))
            {
                int op1 = Integer.parseInt(stack.pop());
                int op2 = Integer.parseInt(stack.pop());
                stack.push(Integer.toString((op1 + op2)));
            }
            else if ("-".equals(s[i]))
            {
                int op1 = Integer.parseInt(stack.pop());
                int op2 = Integer.parseInt(stack.pop());
                stack.push(Integer.toString((op2 - op1)));
            }
            else if ("*".equals(s[i]))
            {
                int op1 = Integer.parseInt(stack.pop());
                int op2 = Integer.parseInt(stack.pop());
                stack.push(Integer.toString((op1 * op2)));
            }
            else
            {
                stack.push(s[i]);
            }
        } {
            if ("+".equals(s[i]))
            {
                int op1 = Integer.parseInt(stack.pop());
                int op2 = Integer.parseInt(stack.pop());
                stack.push(Integer.toString((op1 + op2)));
            }
            else if ("-".equals(s[i]))
            {
                int op1 = Integer.parseInt(stack.pop());
                int op2 = Integer.parseInt(stack.pop());
                stack.push(Integer.toString((op2 - op1)));
            }
            else if ("*".equals(s[i]))
            {
                int op1 = Integer.parseInt(stack.pop());
                int op2 = Integer.parseInt(stack.pop());
                stack.push(Integer.toString((op1 * op2)));
            }
            else
            {
                stack.push(s[i]);
            }
        } if ("+".equals(s[i]))
            {
                int op1 = Integer.parseInt(stack.pop());
                int op2 = Integer.parseInt(stack.pop());
                stack.push(Integer.toString((op1 + op2)));
            }
            else if ("-".equals(s[i]))
            {
                int op1 = Integer.parseInt(stack.pop());
                int op2 = Integer.parseInt(stack.pop());
                stack.push(Integer.toString((op2 - op1)));
            }
            else if ("*".equals(s[i]))
            {
                int op1 = Integer.parseInt(stack.pop());
                int op2 = Integer.parseInt(stack.pop());
                stack.push(Integer.toString((op1 * op2)));
            }
            else
            {
                stack.push(s[i]);
            } "+".equals(s[i]) "+".equals "+" s[i] s i {
                int op1 = Integer.parseInt(stack.pop());
                int op2 = Integer.parseInt(stack.pop());
                stack.push(Integer.toString((op1 + op2)));
            } int op1 = Integer.parseInt(stack.pop()); op1 Integer.parseInt(stack.pop()) Integer.parseInt Integer stack.pop() stack.pop stack int op2 = Integer.parseInt(stack.pop()); op2 Integer.parseInt(stack.pop()) Integer.parseInt Integer stack.pop() stack.pop stack stack.push(Integer.toString((op1 + op2))) stack.push stack Integer.toString((op1 + op2)) Integer.toString Integer (op1 + op2) op1 op2 if ("-".equals(s[i]))
            {
                int op1 = Integer.parseInt(stack.pop());
                int op2 = Integer.parseInt(stack.pop());
                stack.push(Integer.toString((op2 - op1)));
            }
            else if ("*".equals(s[i]))
            {
                int op1 = Integer.parseInt(stack.pop());
                int op2 = Integer.parseInt(stack.pop());
                stack.push(Integer.toString((op1 * op2)));
            }
            else
            {
                stack.push(s[i]);
            } "-".equals(s[i]) "-".equals "-" s[i] s i {
                int op1 = Integer.parseInt(stack.pop());
                int op2 = Integer.parseInt(stack.pop());
                stack.push(Integer.toString((op2 - op1)));
            } int op1 = Integer.parseInt(stack.pop()); op1 Integer.parseInt(stack.pop()) Integer.parseInt Integer stack.pop() stack.pop stack int op2 = Integer.parseInt(stack.pop()); op2 Integer.parseInt(stack.pop()) Integer.parseInt Integer stack.pop() stack.pop stack stack.push(Integer.toString((op2 - op1))) stack.push stack Integer.toString((op2 - op1)) Integer.toString Integer (op2 - op1) op2 op1 if ("*".equals(s[i]))
            {
                int op1 = Integer.parseInt(stack.pop());
                int op2 = Integer.parseInt(stack.pop());
                stack.push(Integer.toString((op1 * op2)));
            }
            else
            {
                stack.push(s[i]);
            } "*".equals(s[i]) "*".equals "*" s[i] s i {
                int op1 = Integer.parseInt(stack.pop());
                int op2 = Integer.parseInt(stack.pop());
                stack.push(Integer.toString((op1 * op2)));
            } int op1 = Integer.parseInt(stack.pop()); op1 Integer.parseInt(stack.pop()) Integer.parseInt Integer stack.pop() stack.pop stack int op2 = Integer.parseInt(stack.pop()); op2 Integer.parseInt(stack.pop()) Integer.parseInt Integer stack.pop() stack.pop stack stack.push(Integer.toString((op1 * op2))) stack.push stack Integer.toString((op1 * op2)) Integer.toString Integer (op1 * op2) op1 op2 {
                stack.push(s[i]);
            } stack.push(s[i]) stack.push stack s[i] s i System.out.println(stack.pop()) System.out.println System.out System System.out stack.pop() stack.pop stack scan.close() scan.close scan String[] args args public class Main
{
    public static void main(String[] args)
    {
        Scanner scan = new Scanner(System.in);
        Stack<String> stack = new Stack<String>();
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

        String line = "";
        try
        {
            line = br.readLine();
        }
        catch (IOException e)
        {
            e.printStackTrace();
        }

        String[] s = line.split(" ");

        for (int i = 0; i < s.length; i++)
        {
            if ("+".equals(s[i]))
            {
                int op1 = Integer.parseInt(stack.pop());
                int op2 = Integer.parseInt(stack.pop());
                stack.push(Integer.toString((op1 + op2)));
            }
            else if ("-".equals(s[i]))
            {
                int op1 = Integer.parseInt(stack.pop());
                int op2 = Integer.parseInt(stack.pop());
                stack.push(Integer.toString((op2 - op1)));
            }
            else if ("*".equals(s[i]))
            {
                int op1 = Integer.parseInt(stack.pop());
                int op2 = Integer.parseInt(stack.pop());
                stack.push(Integer.toString((op1 * op2)));
            }
            else
            {
                stack.push(s[i]);
            }
        }

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

} public class Main
{
    public static void main(String[] args)
    {
        Scanner scan = new Scanner(System.in);
        Stack<String> stack = new Stack<String>();
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

        String line = "";
        try
        {
            line = br.readLine();
        }
        catch (IOException e)
        {
            e.printStackTrace();
        }

        String[] s = line.split(" ");

        for (int i = 0; i < s.length; i++)
        {
            if ("+".equals(s[i]))
            {
                int op1 = Integer.parseInt(stack.pop());
                int op2 = Integer.parseInt(stack.pop());
                stack.push(Integer.toString((op1 + op2)));
            }
            else if ("-".equals(s[i]))
            {
                int op1 = Integer.parseInt(stack.pop());
                int op2 = Integer.parseInt(stack.pop());
                stack.push(Integer.toString((op2 - op1)));
            }
            else if ("*".equals(s[i]))
            {
                int op1 = Integer.parseInt(stack.pop());
                int op2 = Integer.parseInt(stack.pop());
                stack.push(Integer.toString((op1 * op2)));
            }
            else
            {
                stack.push(s[i]);
            }
        }

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

} Main
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Scanner;
import java.util.Stack;

public class Main
{
    public static void main(String[] args)
    {
        Scanner scan = new Scanner(System.in);
        Stack<String> stack = new Stack<String>();
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

        String line = "";
        try
        {
            line = br.readLine();
        }
        catch (IOException e)
        {
            e.printStackTrace();
        }

        String[] s = line.split(" ");

        for (int i = 0; i < s.length; i++)
        {
            if ("+".equals(s[i]))
            {
                int op1 = Integer.parseInt(stack.pop());
                int op2 = Integer.parseInt(stack.pop());
                stack.push(Integer.toString((op1 + op2)));
            }
            else if ("-".equals(s[i]))
            {
                int op1 = Integer.parseInt(stack.pop());
                int op2 = Integer.parseInt(stack.pop());
                stack.push(Integer.toString((op2 - op1)));
            }
            else if ("*".equals(s[i]))
            {
                int op1 = Integer.parseInt(stack.pop());
                int op2 = Integer.parseInt(stack.pop());
                stack.push(Integer.toString((op1 * op2)));
            }
            else
            {
                stack.push(s[i]);
            }
        }

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

}