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

 class Postfix implements Runnable{
     public void run(){
                 try{
                     Scanner in = new Scanner(new File("postfix.in"));
                     PrintWriter out = new PrintWriter(new File("postfix.out"));
                     boolean res = true;

                     LinkedList<Integer> m = new LinkedList<Integer>();

                     while(in.hasNext()){
                     while(in.hasNextInt()) {

                       m.addLast(in.nextInt());
                       m.addLast(in.nextInt());
                       char c = (in.next()).charAt(0);
                      if(c == '+'){
                          int tmp1 = m.getLast();
                          m.removeLast();
                          int tmp2 = m.getLast();
                          m.removeLast();
                          m.addLast(tmp2 + tmp1);
                       }
                      if(c == '-'){
                          int tmp1 = m.getLast();
                          m.removeLast();
                          int tmp2 = m.getLast();
                          m.removeLast();
                          m.addLast(tmp2 - tmp1);
                       }
                     if(c == '*'){
                          int tmp1 = m.getLast();
                          m.removeLast();
                          int tmp2 = m.getLast();
                           m.removeLast();
                           m.addLast(tmp1 * tmp2);
                       }

                     }

                     char c = (in.next()).charAt(0);
                     if(c == '+'){
                          int tmp1 = m.getLast();
                          m.removeLast();
                          int tmp2 = m.getLast();
                          m.removeLast();
                          m.addLast(tmp2 + tmp1);
                       }
                      if(c == '-'){
                          int tmp1 = m.getLast();
                          m.removeLast();
                          int tmp2 = m.getLast();
                          m.removeLast();
                          m.addLast(tmp2 - tmp1);
                       }
                     if(c == '*'){
                          int tmp1 = m.getLast();
                          m.removeLast();
                          int tmp2 = m.getLast();
                           m.removeLast();
                           m.addLast(tmp1 * tmp2);
                       }
                     }
                     out.write(m.getLast() + "");

                     in.close();
                     out.close();
                 }  catch(Exception e){
                      e.printStackTrace();
                      System.exit(1);
                    }
               }
               public static void main(String[] args) {
                  new Thread(new Postfix()).start();
               }

}
