import java.util.*;
import java.lang.*;
class Main {
  static int stacksize = 200;
  static int stackpointer = 0;
  static int [] stack = new int[stacksize];
//push
  static void push(int num){
    stack[stackpointer++] = num;
  }
  //pop
  static int pop(){
    return stack[--stackpointer];
  }
  //main
  public static void main(String args[]){
    Scanner sc = new Scanner(System.in);
    String [] s = sc.nextLine().split("\\s+");
    for(int i = 0; i<s.length; i++){

      if(s[i].equals("+")){
        push(pop()+pop());
      }else if(s[i].equals("-")){
        push(-(pop()-pop()));
      }else if(s[i].equals("*")){
        push(pop()*pop());
      }else{
        push(Integer.valueOf(s[i]));
      }
    }
    System.out.println(pop());
  }
} import java.util.*; util.* java import java.lang.*; lang.* java class Main {
  static int stacksize = 200;
  static int stackpointer = 0;
  static int [] stack = new int[stacksize];
//push
  static void push(int num){
    stack[stackpointer++] = num;
  }
  //pop
  static int pop(){
    return stack[--stackpointer];
  }
  //main
  public static void main(String args[]){
    Scanner sc = new Scanner(System.in);
    String [] s = sc.nextLine().split("\\s+");
    for(int i = 0; i<s.length; i++){

      if(s[i].equals("+")){
        push(pop()+pop());
      }else if(s[i].equals("-")){
        push(-(pop()-pop()));
      }else if(s[i].equals("*")){
        push(pop()*pop());
      }else{
        push(Integer.valueOf(s[i]));
      }
    }
    System.out.println(pop());
  }
} Main static int stacksize = 200; stacksize 200 static int stackpointer = 0; stackpointer 0 static int [] stack = new int[stacksize]; stack new int[stacksize] stacksize //push
  static void push(int num){
    stack[stackpointer++] = num;
  } push {
    stack[stackpointer++] = num;
  } stack[stackpointer++] = num stack[stackpointer++] stack stackpointer++ stackpointer num int num num //pop
  static int pop(){
    return stack[--stackpointer];
  } pop {
    return stack[--stackpointer];
  } return stack[--stackpointer]; stack[--stackpointer] stack --stackpointer stackpointer //main
  public static void main(String args[]){
    Scanner sc = new Scanner(System.in);
    String [] s = sc.nextLine().split("\\s+");
    for(int i = 0; i<s.length; i++){

      if(s[i].equals("+")){
        push(pop()+pop());
      }else if(s[i].equals("-")){
        push(-(pop()-pop()));
      }else if(s[i].equals("*")){
        push(pop()*pop());
      }else{
        push(Integer.valueOf(s[i]));
      }
    }
    System.out.println(pop());
  } main {
    Scanner sc = new Scanner(System.in);
    String [] s = sc.nextLine().split("\\s+");
    for(int i = 0; i<s.length; i++){

      if(s[i].equals("+")){
        push(pop()+pop());
      }else if(s[i].equals("-")){
        push(-(pop()-pop()));
      }else if(s[i].equals("*")){
        push(pop()*pop());
      }else{
        push(Integer.valueOf(s[i]));
      }
    }
    System.out.println(pop());
  } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String [] s = sc.nextLine().split("\\s+"); s sc.nextLine().split("\\s+") sc.nextLine().split sc.nextLine() sc.nextLine sc "\\s+" for(int i = 0; i<s.length; i++){

      if(s[i].equals("+")){
        push(pop()+pop());
      }else if(s[i].equals("-")){
        push(-(pop()-pop()));
      }else if(s[i].equals("*")){
        push(pop()*pop());
      }else{
        push(Integer.valueOf(s[i]));
      }
    } int i = 0; int i = 0; i 0 i<s.length i s.length s s.length i++ i++ i {

      if(s[i].equals("+")){
        push(pop()+pop());
      }else if(s[i].equals("-")){
        push(-(pop()-pop()));
      }else if(s[i].equals("*")){
        push(pop()*pop());
      }else{
        push(Integer.valueOf(s[i]));
      }
    } {

      if(s[i].equals("+")){
        push(pop()+pop());
      }else if(s[i].equals("-")){
        push(-(pop()-pop()));
      }else if(s[i].equals("*")){
        push(pop()*pop());
      }else{
        push(Integer.valueOf(s[i]));
      }
    } if(s[i].equals("+")){
        push(pop()+pop());
      }else if(s[i].equals("-")){
        push(-(pop()-pop()));
      }else if(s[i].equals("*")){
        push(pop()*pop());
      }else{
        push(Integer.valueOf(s[i]));
      } s[i].equals("+") s[i].equals s[i] s i "+" {
        push(pop()+pop());
      } push(pop()+pop()) push pop()+pop() pop() pop pop() pop if(s[i].equals("-")){
        push(-(pop()-pop()));
      }else if(s[i].equals("*")){
        push(pop()*pop());
      }else{
        push(Integer.valueOf(s[i]));
      } s[i].equals("-") s[i].equals s[i] s i "-" {
        push(-(pop()-pop()));
      } push(-(pop()-pop())) push -(pop()-pop()) (pop()-pop()) pop() pop pop() pop if(s[i].equals("*")){
        push(pop()*pop());
      }else{
        push(Integer.valueOf(s[i]));
      } s[i].equals("*") s[i].equals s[i] s i "*" {
        push(pop()*pop());
      } push(pop()*pop()) push pop()*pop() pop() pop pop() pop {
        push(Integer.valueOf(s[i]));
      } push(Integer.valueOf(s[i])) push Integer.valueOf(s[i]) Integer.valueOf Integer s[i] s i System.out.println(pop()) System.out.println System.out System System.out pop() pop String args[] args
import java.util.*;
import java.lang.*;
class Main {
  static int stacksize = 200;
  static int stackpointer = 0;
  static int [] stack = new int[stacksize];
//push
  static void push(int num){
    stack[stackpointer++] = num;
  }
  //pop
  static int pop(){
    return stack[--stackpointer];
  }
  //main
  public static void main(String args[]){
    Scanner sc = new Scanner(System.in);
    String [] s = sc.nextLine().split("\\s+");
    for(int i = 0; i<s.length; i++){

      if(s[i].equals("+")){
        push(pop()+pop());
      }else if(s[i].equals("-")){
        push(-(pop()-pop()));
      }else if(s[i].equals("*")){
        push(pop()*pop());
      }else{
        push(Integer.valueOf(s[i]));
      }
    }
    System.out.println(pop());
  }
}
