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();
            if(input.equals("+")) input = String.valueOf(Integer.parseInt(formula.poll())+Integer.parseInt(formula.poll()));
            else if(input.equals("-")) input = String.valueOf(-1*Integer.parseInt(formula.poll())+Integer.parseInt(formula.poll()));
            else if(input.equals("*")) input = String.valueOf(Integer.parseInt(formula.poll())*Integer.parseInt(formula.poll()));
            formula.push(input);
        }
        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();
            if(input.equals("+")) input = String.valueOf(Integer.parseInt(formula.poll())+Integer.parseInt(formula.poll()));
            else if(input.equals("-")) input = String.valueOf(-1*Integer.parseInt(formula.poll())+Integer.parseInt(formula.poll()));
            else if(input.equals("*")) input = String.valueOf(Integer.parseInt(formula.poll())*Integer.parseInt(formula.poll()));
            formula.push(input);
        }
        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();
            if(input.equals("+")) input = String.valueOf(Integer.parseInt(formula.poll())+Integer.parseInt(formula.poll()));
            else if(input.equals("-")) input = String.valueOf(-1*Integer.parseInt(formula.poll())+Integer.parseInt(formula.poll()));
            else if(input.equals("*")) input = String.valueOf(Integer.parseInt(formula.poll())*Integer.parseInt(formula.poll()));
            formula.push(input);
        }
        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();
            if(input.equals("+")) input = String.valueOf(Integer.parseInt(formula.poll())+Integer.parseInt(formula.poll()));
            else if(input.equals("-")) input = String.valueOf(-1*Integer.parseInt(formula.poll())+Integer.parseInt(formula.poll()));
            else if(input.equals("*")) input = String.valueOf(Integer.parseInt(formula.poll())*Integer.parseInt(formula.poll()));
            formula.push(input);
        }
        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();
            if(input.equals("+")) input = String.valueOf(Integer.parseInt(formula.poll())+Integer.parseInt(formula.poll()));
            else if(input.equals("-")) input = String.valueOf(-1*Integer.parseInt(formula.poll())+Integer.parseInt(formula.poll()));
            else if(input.equals("*")) input = String.valueOf(Integer.parseInt(formula.poll())*Integer.parseInt(formula.poll()));
            formula.push(input);
        } scan.hasNext() scan.hasNext scan {
            String input = scan.next();
            if(input.equals("+")) input = String.valueOf(Integer.parseInt(formula.poll())+Integer.parseInt(formula.poll()));
            else if(input.equals("-")) input = String.valueOf(-1*Integer.parseInt(formula.poll())+Integer.parseInt(formula.poll()));
            else if(input.equals("*")) input = String.valueOf(Integer.parseInt(formula.poll())*Integer.parseInt(formula.poll()));
            formula.push(input);
        } String input = scan.next(); input scan.next() scan.next scan if(input.equals("+")) input = String.valueOf(Integer.parseInt(formula.poll())+Integer.parseInt(formula.poll()));
            else if(input.equals("-")) input = String.valueOf(-1*Integer.parseInt(formula.poll())+Integer.parseInt(formula.poll()));
            else if(input.equals("*")) input = String.valueOf(Integer.parseInt(formula.poll())*Integer.parseInt(formula.poll())); input.equals("+") input.equals input "+" input = String.valueOf(Integer.parseInt(formula.poll())+Integer.parseInt(formula.poll())) input String.valueOf(Integer.parseInt(formula.poll())+Integer.parseInt(formula.poll())) String.valueOf String Integer.parseInt(formula.poll())+Integer.parseInt(formula.poll()) Integer.parseInt(formula.poll()) Integer.parseInt Integer formula.poll() formula.poll formula Integer.parseInt(formula.poll()) Integer.parseInt Integer formula.poll() formula.poll formula if(input.equals("-")) input = String.valueOf(-1*Integer.parseInt(formula.poll())+Integer.parseInt(formula.poll()));
            else if(input.equals("*")) input = String.valueOf(Integer.parseInt(formula.poll())*Integer.parseInt(formula.poll())); input.equals("-") input.equals input "-" input = String.valueOf(-1*Integer.parseInt(formula.poll())+Integer.parseInt(formula.poll())) input String.valueOf(-1*Integer.parseInt(formula.poll())+Integer.parseInt(formula.poll())) String.valueOf String -1*Integer.parseInt(formula.poll())+Integer.parseInt(formula.poll()) -1*Integer.parseInt(formula.poll()) -1 1 Integer.parseInt(formula.poll()) Integer.parseInt Integer formula.poll() formula.poll formula Integer.parseInt(formula.poll()) Integer.parseInt Integer formula.poll() formula.poll formula if(input.equals("*")) input = String.valueOf(Integer.parseInt(formula.poll())*Integer.parseInt(formula.poll())); input.equals("*") input.equals input "*" input = String.valueOf(Integer.parseInt(formula.poll())*Integer.parseInt(formula.poll())) input String.valueOf(Integer.parseInt(formula.poll())*Integer.parseInt(formula.poll())) String.valueOf String Integer.parseInt(formula.poll())*Integer.parseInt(formula.poll()) Integer.parseInt(formula.poll()) Integer.parseInt Integer formula.poll() formula.poll formula Integer.parseInt(formula.poll()) Integer.parseInt Integer formula.poll() formula.poll formula formula.push(input) formula.push formula input 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();
            if(input.equals("+")) input = String.valueOf(Integer.parseInt(formula.poll())+Integer.parseInt(formula.poll()));
            else if(input.equals("-")) input = String.valueOf(-1*Integer.parseInt(formula.poll())+Integer.parseInt(formula.poll()));
            else if(input.equals("*")) input = String.valueOf(Integer.parseInt(formula.poll())*Integer.parseInt(formula.poll()));
            formula.push(input);
        }
        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();
            if(input.equals("+")) input = String.valueOf(Integer.parseInt(formula.poll())+Integer.parseInt(formula.poll()));
            else if(input.equals("-")) input = String.valueOf(-1*Integer.parseInt(formula.poll())+Integer.parseInt(formula.poll()));
            else if(input.equals("*")) input = String.valueOf(Integer.parseInt(formula.poll())*Integer.parseInt(formula.poll()));
            formula.push(input);
        }
        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();
            if(input.equals("+")) input = String.valueOf(Integer.parseInt(formula.poll())+Integer.parseInt(formula.poll()));
            else if(input.equals("-")) input = String.valueOf(-1*Integer.parseInt(formula.poll())+Integer.parseInt(formula.poll()));
            else if(input.equals("*")) input = String.valueOf(Integer.parseInt(formula.poll())*Integer.parseInt(formula.poll()));
            formula.push(input);
        }
        System.out.println(formula.poll());
    }
}