public class Main{
  static int top = 0;
  public void run(java.io.InputStream in, java.io.PrintStream out){
    java.util.Scanner sc = new java.util.Scanner(in);
/*answer*/
    int[] stack;
    String prec;
    char c;

    stack = new int[200];
    top = 0;

    for(;;){
      if(!sc.hasNext())break;
      prec = sc.next();
      c = prec.charAt(0);
      if('0' <= c && c <= '9'){
        push(stack, Integer.parseInt(prec));
      }else if(c == '+'){
        push(stack, pop(stack) + pop(stack));
      }else if(c == '-'){
        push(stack,  -pop(stack) + pop(stack));
      }else if(c == '*'){
        push(stack, pop(stack) * pop(stack));
      }else{
        break;
      }
    }

    System.out.println(pop(stack));

    sc.close();
  }
  public static void main(String[] args){
    (new Main()).run(System.in, System.out);
  }

  private static int pop(int[] stack){
    return stack[--top];
  }

  private static void push(int[] stack, int a){
    stack[top++] = a;
    return;
  }
} public class Main{
  static int top = 0;
  public void run(java.io.InputStream in, java.io.PrintStream out){
    java.util.Scanner sc = new java.util.Scanner(in);
/*answer*/
    int[] stack;
    String prec;
    char c;

    stack = new int[200];
    top = 0;

    for(;;){
      if(!sc.hasNext())break;
      prec = sc.next();
      c = prec.charAt(0);
      if('0' <= c && c <= '9'){
        push(stack, Integer.parseInt(prec));
      }else if(c == '+'){
        push(stack, pop(stack) + pop(stack));
      }else if(c == '-'){
        push(stack,  -pop(stack) + pop(stack));
      }else if(c == '*'){
        push(stack, pop(stack) * pop(stack));
      }else{
        break;
      }
    }

    System.out.println(pop(stack));

    sc.close();
  }
  public static void main(String[] args){
    (new Main()).run(System.in, System.out);
  }

  private static int pop(int[] stack){
    return stack[--top];
  }

  private static void push(int[] stack, int a){
    stack[top++] = a;
    return;
  }
} Main static int top = 0; top 0 public void run(java.io.InputStream in, java.io.PrintStream out){
    java.util.Scanner sc = new java.util.Scanner(in);
/*answer*/
    int[] stack;
    String prec;
    char c;

    stack = new int[200];
    top = 0;

    for(;;){
      if(!sc.hasNext())break;
      prec = sc.next();
      c = prec.charAt(0);
      if('0' <= c && c <= '9'){
        push(stack, Integer.parseInt(prec));
      }else if(c == '+'){
        push(stack, pop(stack) + pop(stack));
      }else if(c == '-'){
        push(stack,  -pop(stack) + pop(stack));
      }else if(c == '*'){
        push(stack, pop(stack) * pop(stack));
      }else{
        break;
      }
    }

    System.out.println(pop(stack));

    sc.close();
  } run {
    java.util.Scanner sc = new java.util.Scanner(in);
/*answer*/
    int[] stack;
    String prec;
    char c;

    stack = new int[200];
    top = 0;

    for(;;){
      if(!sc.hasNext())break;
      prec = sc.next();
      c = prec.charAt(0);
      if('0' <= c && c <= '9'){
        push(stack, Integer.parseInt(prec));
      }else if(c == '+'){
        push(stack, pop(stack) + pop(stack));
      }else if(c == '-'){
        push(stack,  -pop(stack) + pop(stack));
      }else if(c == '*'){
        push(stack, pop(stack) * pop(stack));
      }else{
        break;
      }
    }

    System.out.println(pop(stack));

    sc.close();
  } java.util.Scanner sc = new java.util.Scanner(in); sc new java.util.Scanner(in) int[] stack; stack String prec; prec char c; c stack = new int[200] stack new int[200] 200 top = 0 top 0 for(;;){
      if(!sc.hasNext())break;
      prec = sc.next();
      c = prec.charAt(0);
      if('0' <= c && c <= '9'){
        push(stack, Integer.parseInt(prec));
      }else if(c == '+'){
        push(stack, pop(stack) + pop(stack));
      }else if(c == '-'){
        push(stack,  -pop(stack) + pop(stack));
      }else if(c == '*'){
        push(stack, pop(stack) * pop(stack));
      }else{
        break;
      }
    } ; {
      if(!sc.hasNext())break;
      prec = sc.next();
      c = prec.charAt(0);
      if('0' <= c && c <= '9'){
        push(stack, Integer.parseInt(prec));
      }else if(c == '+'){
        push(stack, pop(stack) + pop(stack));
      }else if(c == '-'){
        push(stack,  -pop(stack) + pop(stack));
      }else if(c == '*'){
        push(stack, pop(stack) * pop(stack));
      }else{
        break;
      }
    } {
      if(!sc.hasNext())break;
      prec = sc.next();
      c = prec.charAt(0);
      if('0' <= c && c <= '9'){
        push(stack, Integer.parseInt(prec));
      }else if(c == '+'){
        push(stack, pop(stack) + pop(stack));
      }else if(c == '-'){
        push(stack,  -pop(stack) + pop(stack));
      }else if(c == '*'){
        push(stack, pop(stack) * pop(stack));
      }else{
        break;
      }
    } if(!sc.hasNext())break; !sc.hasNext() sc.hasNext() sc.hasNext sc break; prec = sc.next() prec sc.next() sc.next sc c = prec.charAt(0) c prec.charAt(0) prec.charAt prec 0 if('0' <= c && c <= '9'){
        push(stack, Integer.parseInt(prec));
      }else if(c == '+'){
        push(stack, pop(stack) + pop(stack));
      }else if(c == '-'){
        push(stack,  -pop(stack) + pop(stack));
      }else if(c == '*'){
        push(stack, pop(stack) * pop(stack));
      }else{
        break;
      } '0' <= c && c <= '9' '0' <= c '0' c c <= '9' c '9' {
        push(stack, Integer.parseInt(prec));
      } push(stack, Integer.parseInt(prec)) push stack Integer.parseInt(prec) Integer.parseInt Integer prec if(c == '+'){
        push(stack, pop(stack) + pop(stack));
      }else if(c == '-'){
        push(stack,  -pop(stack) + pop(stack));
      }else if(c == '*'){
        push(stack, pop(stack) * pop(stack));
      }else{
        break;
      } c == '+' c '+' {
        push(stack, pop(stack) + pop(stack));
      } push(stack, pop(stack) + pop(stack)) push stack pop(stack) + pop(stack) pop(stack) pop stack pop(stack) pop stack if(c == '-'){
        push(stack,  -pop(stack) + pop(stack));
      }else if(c == '*'){
        push(stack, pop(stack) * pop(stack));
      }else{
        break;
      } c == '-' c '-' {
        push(stack,  -pop(stack) + pop(stack));
      } push(stack,  -pop(stack) + pop(stack)) push stack -pop(stack) + pop(stack) -pop(stack) pop(stack) pop stack pop(stack) pop stack if(c == '*'){
        push(stack, pop(stack) * pop(stack));
      }else{
        break;
      } c == '*' c '*' {
        push(stack, pop(stack) * pop(stack));
      } push(stack, pop(stack) * pop(stack)) push stack pop(stack) * pop(stack) pop(stack) pop stack pop(stack) pop stack {
        break;
      } break; System.out.println(pop(stack)) System.out.println System.out System System.out pop(stack) pop stack sc.close() sc.close sc java.io.InputStream in in java.io.PrintStream out out public static void main(String[] args){
    (new Main()).run(System.in, System.out);
  } main {
    (new Main()).run(System.in, System.out);
  } (new Main()).run(System.in, System.out) (new Main()).run (new Main()) System.in System System.in System.out System System.out String[] args args private static int pop(int[] stack){
    return stack[--top];
  } pop {
    return stack[--top];
  } return stack[--top]; stack[--top] stack --top top int[] stack stack private static void push(int[] stack, int a){
    stack[top++] = a;
    return;
  } push {
    stack[top++] = a;
    return;
  } stack[top++] = a stack[top++] stack top++ top a return; int[] stack stack int a a public class Main{
  static int top = 0;
  public void run(java.io.InputStream in, java.io.PrintStream out){
    java.util.Scanner sc = new java.util.Scanner(in);
/*answer*/
    int[] stack;
    String prec;
    char c;

    stack = new int[200];
    top = 0;

    for(;;){
      if(!sc.hasNext())break;
      prec = sc.next();
      c = prec.charAt(0);
      if('0' <= c && c <= '9'){
        push(stack, Integer.parseInt(prec));
      }else if(c == '+'){
        push(stack, pop(stack) + pop(stack));
      }else if(c == '-'){
        push(stack,  -pop(stack) + pop(stack));
      }else if(c == '*'){
        push(stack, pop(stack) * pop(stack));
      }else{
        break;
      }
    }

    System.out.println(pop(stack));

    sc.close();
  }
  public static void main(String[] args){
    (new Main()).run(System.in, System.out);
  }

  private static int pop(int[] stack){
    return stack[--top];
  }

  private static void push(int[] stack, int a){
    stack[top++] = a;
    return;
  }
} public class Main{
  static int top = 0;
  public void run(java.io.InputStream in, java.io.PrintStream out){
    java.util.Scanner sc = new java.util.Scanner(in);
/*answer*/
    int[] stack;
    String prec;
    char c;

    stack = new int[200];
    top = 0;

    for(;;){
      if(!sc.hasNext())break;
      prec = sc.next();
      c = prec.charAt(0);
      if('0' <= c && c <= '9'){
        push(stack, Integer.parseInt(prec));
      }else if(c == '+'){
        push(stack, pop(stack) + pop(stack));
      }else if(c == '-'){
        push(stack,  -pop(stack) + pop(stack));
      }else if(c == '*'){
        push(stack, pop(stack) * pop(stack));
      }else{
        break;
      }
    }

    System.out.println(pop(stack));

    sc.close();
  }
  public static void main(String[] args){
    (new Main()).run(System.in, System.out);
  }

  private static int pop(int[] stack){
    return stack[--top];
  }

  private static void push(int[] stack, int a){
    stack[top++] = a;
    return;
  }
} Main
public class Main{
  static int top = 0;
  public void run(java.io.InputStream in, java.io.PrintStream out){
    java.util.Scanner sc = new java.util.Scanner(in);
/*answer*/
    int[] stack;
    String prec;
    char c;

    stack = new int[200];
    top = 0;

    for(;;){
      if(!sc.hasNext())break;
      prec = sc.next();
      c = prec.charAt(0);
      if('0' <= c && c <= '9'){
        push(stack, Integer.parseInt(prec));
      }else if(c == '+'){
        push(stack, pop(stack) + pop(stack));
      }else if(c == '-'){
        push(stack,  -pop(stack) + pop(stack));
      }else if(c == '*'){
        push(stack, pop(stack) * pop(stack));
      }else{
        break;
      }
    }

    System.out.println(pop(stack));

    sc.close();
  }
  public static void main(String[] args){
    (new Main()).run(System.in, System.out);
  }

  private static int pop(int[] stack){
    return stack[--top];
  }

  private static void push(int[] stack, int a){
    stack[top++] = a;
    return;
  }
}