import java.util.Scanner;

class Main{
  String[] data = new String[200];
  int num;

  Main(){
    this.num = 0;
  }

  boolean push(String c){
    if(this.isFull())
      return false;
    else{
      this.data[++num] = c;
      return true;
    }
  }

  String pop(){
    return this.data[num--];
  }

  boolean isFull(){
    return num == 199;
  }

  boolean isEmpty(){
    return num == 0;
  }


  public static void main(String[] args){
    Scanner stdIn = new Scanner(System.in);
    int ans;
    int ope1, ope2;
    Main stack = new Main();

    while(stdIn.hasNext()){
      String input = stdIn.next();
      if(input.equals("+") || input.equals("-") || input.equals("*")){
        ope2 = Integer.parseInt(stack.pop());
        ope1 = Integer.parseInt(stack.pop());
          if(input.equals("+"))
            ans = ope1 + ope2;
          else if(input.equals("-"))
            ans = ope1 - ope2;
          else
            ans = ope1 * ope2;
        stack.push(Integer.toString(ans));
      }
      else{
        stack.push(input);
      }
    }

  
    System.out.println(stack.pop());
  }
} import java.util.Scanner; Scanner java.util class Main{
  String[] data = new String[200];
  int num;

  Main(){
    this.num = 0;
  }

  boolean push(String c){
    if(this.isFull())
      return false;
    else{
      this.data[++num] = c;
      return true;
    }
  }

  String pop(){
    return this.data[num--];
  }

  boolean isFull(){
    return num == 199;
  }

  boolean isEmpty(){
    return num == 0;
  }


  public static void main(String[] args){
    Scanner stdIn = new Scanner(System.in);
    int ans;
    int ope1, ope2;
    Main stack = new Main();

    while(stdIn.hasNext()){
      String input = stdIn.next();
      if(input.equals("+") || input.equals("-") || input.equals("*")){
        ope2 = Integer.parseInt(stack.pop());
        ope1 = Integer.parseInt(stack.pop());
          if(input.equals("+"))
            ans = ope1 + ope2;
          else if(input.equals("-"))
            ans = ope1 - ope2;
          else
            ans = ope1 * ope2;
        stack.push(Integer.toString(ans));
      }
      else{
        stack.push(input);
      }
    }

  
    System.out.println(stack.pop());
  }
} Main String[] data = new String[200]; data new String[200] 200 int num; num Main(){
    this.num = 0;
  } Main {
    this.num = 0;
  } this.num = 0 this.num this this.num 0 boolean push(String c){
    if(this.isFull())
      return false;
    else{
      this.data[++num] = c;
      return true;
    }
  } push {
    if(this.isFull())
      return false;
    else{
      this.data[++num] = c;
      return true;
    }
  } if(this.isFull())
      return false;
    else{
      this.data[++num] = c;
      return true;
    } this.isFull() this.isFull this return false; false {
      this.data[++num] = c;
      return true;
    } this.data[++num] = c this.data[++num] this.data this this.data ++num num c return true; true String c c String pop(){
    return this.data[num--];
  } pop {
    return this.data[num--];
  } return this.data[num--]; this.data[num--] this.data this this.data num-- num boolean isFull(){
    return num == 199;
  } isFull {
    return num == 199;
  } return num == 199; num == 199 num 199 boolean isEmpty(){
    return num == 0;
  } isEmpty {
    return num == 0;
  } return num == 0; num == 0 num 0 public static void main(String[] args){
    Scanner stdIn = new Scanner(System.in);
    int ans;
    int ope1, ope2;
    Main stack = new Main();

    while(stdIn.hasNext()){
      String input = stdIn.next();
      if(input.equals("+") || input.equals("-") || input.equals("*")){
        ope2 = Integer.parseInt(stack.pop());
        ope1 = Integer.parseInt(stack.pop());
          if(input.equals("+"))
            ans = ope1 + ope2;
          else if(input.equals("-"))
            ans = ope1 - ope2;
          else
            ans = ope1 * ope2;
        stack.push(Integer.toString(ans));
      }
      else{
        stack.push(input);
      }
    }

  
    System.out.println(stack.pop());
  } main {
    Scanner stdIn = new Scanner(System.in);
    int ans;
    int ope1, ope2;
    Main stack = new Main();

    while(stdIn.hasNext()){
      String input = stdIn.next();
      if(input.equals("+") || input.equals("-") || input.equals("*")){
        ope2 = Integer.parseInt(stack.pop());
        ope1 = Integer.parseInt(stack.pop());
          if(input.equals("+"))
            ans = ope1 + ope2;
          else if(input.equals("-"))
            ans = ope1 - ope2;
          else
            ans = ope1 * ope2;
        stack.push(Integer.toString(ans));
      }
      else{
        stack.push(input);
      }
    }

  
    System.out.println(stack.pop());
  } Scanner stdIn = new Scanner(System.in); stdIn new Scanner(System.in) int ans; ans int ope1 ope1 ope2; ope2 Main stack = new Main(); stack new Main() while(stdIn.hasNext()){
      String input = stdIn.next();
      if(input.equals("+") || input.equals("-") || input.equals("*")){
        ope2 = Integer.parseInt(stack.pop());
        ope1 = Integer.parseInt(stack.pop());
          if(input.equals("+"))
            ans = ope1 + ope2;
          else if(input.equals("-"))
            ans = ope1 - ope2;
          else
            ans = ope1 * ope2;
        stack.push(Integer.toString(ans));
      }
      else{
        stack.push(input);
      }
    } stdIn.hasNext() stdIn.hasNext stdIn {
      String input = stdIn.next();
      if(input.equals("+") || input.equals("-") || input.equals("*")){
        ope2 = Integer.parseInt(stack.pop());
        ope1 = Integer.parseInt(stack.pop());
          if(input.equals("+"))
            ans = ope1 + ope2;
          else if(input.equals("-"))
            ans = ope1 - ope2;
          else
            ans = ope1 * ope2;
        stack.push(Integer.toString(ans));
      }
      else{
        stack.push(input);
      }
    } String input = stdIn.next(); input stdIn.next() stdIn.next stdIn if(input.equals("+") || input.equals("-") || input.equals("*")){
        ope2 = Integer.parseInt(stack.pop());
        ope1 = Integer.parseInt(stack.pop());
          if(input.equals("+"))
            ans = ope1 + ope2;
          else if(input.equals("-"))
            ans = ope1 - ope2;
          else
            ans = ope1 * ope2;
        stack.push(Integer.toString(ans));
      }
      else{
        stack.push(input);
      } input.equals("+") || input.equals("-") || input.equals("*") input.equals("+") || input.equals("-") || input.equals("*") input.equals("+") input.equals input "+" input.equals("-") input.equals input "-" input.equals("*") input.equals input "*" {
        ope2 = Integer.parseInt(stack.pop());
        ope1 = Integer.parseInt(stack.pop());
          if(input.equals("+"))
            ans = ope1 + ope2;
          else if(input.equals("-"))
            ans = ope1 - ope2;
          else
            ans = ope1 * ope2;
        stack.push(Integer.toString(ans));
      } ope2 = Integer.parseInt(stack.pop()) ope2 Integer.parseInt(stack.pop()) Integer.parseInt Integer stack.pop() stack.pop stack ope1 = Integer.parseInt(stack.pop()) ope1 Integer.parseInt(stack.pop()) Integer.parseInt Integer stack.pop() stack.pop stack if(input.equals("+"))
            ans = ope1 + ope2;
          else if(input.equals("-"))
            ans = ope1 - ope2;
          else
            ans = ope1 * ope2; input.equals("+") input.equals input "+" ans = ope1 + ope2 ans ope1 + ope2 ope1 ope2 if(input.equals("-"))
            ans = ope1 - ope2;
          else
            ans = ope1 * ope2; input.equals("-") input.equals input "-" ans = ope1 - ope2 ans ope1 - ope2 ope1 ope2 ans = ope1 * ope2 ans ope1 * ope2 ope1 ope2 stack.push(Integer.toString(ans)) stack.push stack Integer.toString(ans) Integer.toString Integer ans {
        stack.push(input);
      } stack.push(input) stack.push stack input System.out.println(stack.pop()) System.out.println System.out System System.out stack.pop() stack.pop stack String[] args args
import java.util.Scanner;

class Main{
  String[] data = new String[200];
  int num;

  Main(){
    this.num = 0;
  }

  boolean push(String c){
    if(this.isFull())
      return false;
    else{
      this.data[++num] = c;
      return true;
    }
  }

  String pop(){
    return this.data[num--];
  }

  boolean isFull(){
    return num == 199;
  }

  boolean isEmpty(){
    return num == 0;
  }


  public static void main(String[] args){
    Scanner stdIn = new Scanner(System.in);
    int ans;
    int ope1, ope2;
    Main stack = new Main();

    while(stdIn.hasNext()){
      String input = stdIn.next();
      if(input.equals("+") || input.equals("-") || input.equals("*")){
        ope2 = Integer.parseInt(stack.pop());
        ope1 = Integer.parseInt(stack.pop());
          if(input.equals("+"))
            ans = ope1 + ope2;
          else if(input.equals("-"))
            ans = ope1 - ope2;
          else
            ans = ope1 * ope2;
        stack.push(Integer.toString(ans));
      }
      else{
        stack.push(input);
      }
    }

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