import java.util.Scanner;
public class Main {
  static int top = 0;
  static int[] number = new int[200];

  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    String s = sc.nextLine();
    String[] str = s.split(" ",0);
    for(int i = 0; i<str.length; i++){
      if(str[i].equals("+")) {
        int a = pop();
        int b = pop();
        push(b+a);
        continue;
      }
      if(str[i].equals("-")) {
        int a = pop();
        int b = pop();
        push(b-a);
        continue;
      }
      if(str[i].equals("*")) {
        int a = pop();
        int b = pop();
        push(b*a);
        continue;
      }
      push(Integer.parseInt(str[i]));
    }
    System.out.println(pop());
  }
  public static int pop() {
    top--;
    return number[top+1];
  }
  public static void push(int i) {
    top++;
    number[top] = i;
  }
} import java.util.Scanner; Scanner java.util public class Main {
  static int top = 0;
  static int[] number = new int[200];

  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    String s = sc.nextLine();
    String[] str = s.split(" ",0);
    for(int i = 0; i<str.length; i++){
      if(str[i].equals("+")) {
        int a = pop();
        int b = pop();
        push(b+a);
        continue;
      }
      if(str[i].equals("-")) {
        int a = pop();
        int b = pop();
        push(b-a);
        continue;
      }
      if(str[i].equals("*")) {
        int a = pop();
        int b = pop();
        push(b*a);
        continue;
      }
      push(Integer.parseInt(str[i]));
    }
    System.out.println(pop());
  }
  public static int pop() {
    top--;
    return number[top+1];
  }
  public static void push(int i) {
    top++;
    number[top] = i;
  }
} Main static int top = 0; top 0 static int[] number = new int[200]; number new int[200] 200 public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    String s = sc.nextLine();
    String[] str = s.split(" ",0);
    for(int i = 0; i<str.length; i++){
      if(str[i].equals("+")) {
        int a = pop();
        int b = pop();
        push(b+a);
        continue;
      }
      if(str[i].equals("-")) {
        int a = pop();
        int b = pop();
        push(b-a);
        continue;
      }
      if(str[i].equals("*")) {
        int a = pop();
        int b = pop();
        push(b*a);
        continue;
      }
      push(Integer.parseInt(str[i]));
    }
    System.out.println(pop());
  } main {
    Scanner sc = new Scanner(System.in);
    String s = sc.nextLine();
    String[] str = s.split(" ",0);
    for(int i = 0; i<str.length; i++){
      if(str[i].equals("+")) {
        int a = pop();
        int b = pop();
        push(b+a);
        continue;
      }
      if(str[i].equals("-")) {
        int a = pop();
        int b = pop();
        push(b-a);
        continue;
      }
      if(str[i].equals("*")) {
        int a = pop();
        int b = pop();
        push(b*a);
        continue;
      }
      push(Integer.parseInt(str[i]));
    }
    System.out.println(pop());
  } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String s = sc.nextLine(); s sc.nextLine() sc.nextLine sc String[] str = s.split(" ",0); str s.split(" ",0) s.split s " " 0 for(int i = 0; i<str.length; i++){
      if(str[i].equals("+")) {
        int a = pop();
        int b = pop();
        push(b+a);
        continue;
      }
      if(str[i].equals("-")) {
        int a = pop();
        int b = pop();
        push(b-a);
        continue;
      }
      if(str[i].equals("*")) {
        int a = pop();
        int b = pop();
        push(b*a);
        continue;
      }
      push(Integer.parseInt(str[i]));
    } int i = 0; int i = 0; i 0 i<str.length i str.length str str.length i++ i++ i {
      if(str[i].equals("+")) {
        int a = pop();
        int b = pop();
        push(b+a);
        continue;
      }
      if(str[i].equals("-")) {
        int a = pop();
        int b = pop();
        push(b-a);
        continue;
      }
      if(str[i].equals("*")) {
        int a = pop();
        int b = pop();
        push(b*a);
        continue;
      }
      push(Integer.parseInt(str[i]));
    } {
      if(str[i].equals("+")) {
        int a = pop();
        int b = pop();
        push(b+a);
        continue;
      }
      if(str[i].equals("-")) {
        int a = pop();
        int b = pop();
        push(b-a);
        continue;
      }
      if(str[i].equals("*")) {
        int a = pop();
        int b = pop();
        push(b*a);
        continue;
      }
      push(Integer.parseInt(str[i]));
    } if(str[i].equals("+")) {
        int a = pop();
        int b = pop();
        push(b+a);
        continue;
      } str[i].equals("+") str[i].equals str[i] str i "+" {
        int a = pop();
        int b = pop();
        push(b+a);
        continue;
      } int a = pop(); a pop() pop int b = pop(); b pop() pop push(b+a) push b+a b a continue; if(str[i].equals("-")) {
        int a = pop();
        int b = pop();
        push(b-a);
        continue;
      } str[i].equals("-") str[i].equals str[i] str i "-" {
        int a = pop();
        int b = pop();
        push(b-a);
        continue;
      } int a = pop(); a pop() pop int b = pop(); b pop() pop push(b-a) push b-a b a continue; if(str[i].equals("*")) {
        int a = pop();
        int b = pop();
        push(b*a);
        continue;
      } str[i].equals("*") str[i].equals str[i] str i "*" {
        int a = pop();
        int b = pop();
        push(b*a);
        continue;
      } int a = pop(); a pop() pop int b = pop(); b pop() pop push(b*a) push b*a b a continue; push(Integer.parseInt(str[i])) push Integer.parseInt(str[i]) Integer.parseInt Integer str[i] str i System.out.println(pop()) System.out.println System.out System System.out pop() pop String[] args args public static int pop() {
    top--;
    return number[top+1];
  } pop {
    top--;
    return number[top+1];
  } top-- top return number[top+1]; number[top+1] number top+1 top 1 public static void push(int i) {
    top++;
    number[top] = i;
  } push {
    top++;
    number[top] = i;
  } top++ top number[top] = i number[top] number top i int i i public class Main {
  static int top = 0;
  static int[] number = new int[200];

  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    String s = sc.nextLine();
    String[] str = s.split(" ",0);
    for(int i = 0; i<str.length; i++){
      if(str[i].equals("+")) {
        int a = pop();
        int b = pop();
        push(b+a);
        continue;
      }
      if(str[i].equals("-")) {
        int a = pop();
        int b = pop();
        push(b-a);
        continue;
      }
      if(str[i].equals("*")) {
        int a = pop();
        int b = pop();
        push(b*a);
        continue;
      }
      push(Integer.parseInt(str[i]));
    }
    System.out.println(pop());
  }
  public static int pop() {
    top--;
    return number[top+1];
  }
  public static void push(int i) {
    top++;
    number[top] = i;
  }
} public class Main {
  static int top = 0;
  static int[] number = new int[200];

  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    String s = sc.nextLine();
    String[] str = s.split(" ",0);
    for(int i = 0; i<str.length; i++){
      if(str[i].equals("+")) {
        int a = pop();
        int b = pop();
        push(b+a);
        continue;
      }
      if(str[i].equals("-")) {
        int a = pop();
        int b = pop();
        push(b-a);
        continue;
      }
      if(str[i].equals("*")) {
        int a = pop();
        int b = pop();
        push(b*a);
        continue;
      }
      push(Integer.parseInt(str[i]));
    }
    System.out.println(pop());
  }
  public static int pop() {
    top--;
    return number[top+1];
  }
  public static void push(int i) {
    top++;
    number[top] = i;
  }
} Main
import java.util.Scanner;
public class Main {
  static int top = 0;
  static int[] number = new int[200];

  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    String s = sc.nextLine();
    String[] str = s.split(" ",0);
    for(int i = 0; i<str.length; i++){
      if(str[i].equals("+")) {
        int a = pop();
        int b = pop();
        push(b+a);
        continue;
      }
      if(str[i].equals("-")) {
        int a = pop();
        int b = pop();
        push(b-a);
        continue;
      }
      if(str[i].equals("*")) {
        int a = pop();
        int b = pop();
        push(b*a);
        continue;
      }
      push(Integer.parseInt(str[i]));
    }
    System.out.println(pop());
  }
  public static int pop() {
    top--;
    return number[top+1];
  }
  public static void push(int i) {
    top++;
    number[top] = i;
  }
}