import java.util.*;

public class Main {
  static int top = 0;
  static int max = 110;
  static int[] stack = new int[max];

  public static boolean isNum(String str) {
    try {
      Integer.parseInt(str);
      return true;
    } catch(NumberFormatException e) {
      return false;
    }
  }
  public static void initialize() {
    top = 0;
  }
  public static boolean isEmpty() {
    return top == 0;
  }
  public static boolean isFull() {
    return top >= max - 1;
  }
  public static void push(int x) {
    if(isFull()) {
      throw new IllegalArgumentException("オーバーフロー");
    } else {
      top++;
      stack[top] = x;
    }
  }
  public static int pop() {
    if(isEmpty()) {
      throw new IllegalArgumentException("アンダーフロー");
    } else {
      top--;
      return stack[top + 1];
    }
  }

  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    String s = "";
    int a;
    while(sc.hasNext()) {
      s = sc.next();
      if(isNum(s)) {
        push(Integer.parseInt(s));
      } else if(s.equals("+")) {
        a = pop() + pop();
        push(a);
      } else if(s.equals("-")) {
        a = - (pop() - pop());
        push(a);
      } else {
        a = pop() * pop();
        push(a);
      }
    }
    System.out.println(pop());
  }
}
 import java.util.*; util.* java public class Main {
  static int top = 0;
  static int max = 110;
  static int[] stack = new int[max];

  public static boolean isNum(String str) {
    try {
      Integer.parseInt(str);
      return true;
    } catch(NumberFormatException e) {
      return false;
    }
  }
  public static void initialize() {
    top = 0;
  }
  public static boolean isEmpty() {
    return top == 0;
  }
  public static boolean isFull() {
    return top >= max - 1;
  }
  public static void push(int x) {
    if(isFull()) {
      throw new IllegalArgumentException("オーバーフロー");
    } else {
      top++;
      stack[top] = x;
    }
  }
  public static int pop() {
    if(isEmpty()) {
      throw new IllegalArgumentException("アンダーフロー");
    } else {
      top--;
      return stack[top + 1];
    }
  }

  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    String s = "";
    int a;
    while(sc.hasNext()) {
      s = sc.next();
      if(isNum(s)) {
        push(Integer.parseInt(s));
      } else if(s.equals("+")) {
        a = pop() + pop();
        push(a);
      } else if(s.equals("-")) {
        a = - (pop() - pop());
        push(a);
      } else {
        a = pop() * pop();
        push(a);
      }
    }
    System.out.println(pop());
  }
} Main static int top = 0; top 0 static int max = 110; max 110 static int[] stack = new int[max]; stack new int[max] max public static boolean isNum(String str) {
    try {
      Integer.parseInt(str);
      return true;
    } catch(NumberFormatException e) {
      return false;
    }
  } isNum {
    try {
      Integer.parseInt(str);
      return true;
    } catch(NumberFormatException e) {
      return false;
    }
  } try {
      Integer.parseInt(str);
      return true;
    } catch(NumberFormatException e) {
      return false;
    } catch(NumberFormatException e) {
      return false;
    } NumberFormatException e {
      return false;
    } return false; false {
      Integer.parseInt(str);
      return true;
    } Integer.parseInt(str) Integer.parseInt Integer str return true; true String str str public static void initialize() {
    top = 0;
  } initialize {
    top = 0;
  } top = 0 top 0 public static boolean isEmpty() {
    return top == 0;
  } isEmpty {
    return top == 0;
  } return top == 0; top == 0 top 0 public static boolean isFull() {
    return top >= max - 1;
  } isFull {
    return top >= max - 1;
  } return top >= max - 1; top >= max - 1 top max - 1 max 1 public static void push(int x) {
    if(isFull()) {
      throw new IllegalArgumentException("オーバーフロー");
    } else {
      top++;
      stack[top] = x;
    }
  } push {
    if(isFull()) {
      throw new IllegalArgumentException("オーバーフロー");
    } else {
      top++;
      stack[top] = x;
    }
  } if(isFull()) {
      throw new IllegalArgumentException("オーバーフロー");
    } else {
      top++;
      stack[top] = x;
    } isFull() isFull {
      throw new IllegalArgumentException("オーバーフロー");
    } throw new IllegalArgumentException("オーバーフロー"); new IllegalArgumentException("オーバーフロー") {
      top++;
      stack[top] = x;
    } top++ top stack[top] = x stack[top] stack top x int x x public static int pop() {
    if(isEmpty()) {
      throw new IllegalArgumentException("アンダーフロー");
    } else {
      top--;
      return stack[top + 1];
    }
  } pop {
    if(isEmpty()) {
      throw new IllegalArgumentException("アンダーフロー");
    } else {
      top--;
      return stack[top + 1];
    }
  } if(isEmpty()) {
      throw new IllegalArgumentException("アンダーフロー");
    } else {
      top--;
      return stack[top + 1];
    } isEmpty() isEmpty {
      throw new IllegalArgumentException("アンダーフロー");
    } throw new IllegalArgumentException("アンダーフロー"); new IllegalArgumentException("アンダーフロー") {
      top--;
      return stack[top + 1];
    } top-- top return stack[top + 1]; stack[top + 1] stack top + 1 top 1 public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    String s = "";
    int a;
    while(sc.hasNext()) {
      s = sc.next();
      if(isNum(s)) {
        push(Integer.parseInt(s));
      } else if(s.equals("+")) {
        a = pop() + pop();
        push(a);
      } else if(s.equals("-")) {
        a = - (pop() - pop());
        push(a);
      } else {
        a = pop() * pop();
        push(a);
      }
    }
    System.out.println(pop());
  } main {
    Scanner sc = new Scanner(System.in);
    String s = "";
    int a;
    while(sc.hasNext()) {
      s = sc.next();
      if(isNum(s)) {
        push(Integer.parseInt(s));
      } else if(s.equals("+")) {
        a = pop() + pop();
        push(a);
      } else if(s.equals("-")) {
        a = - (pop() - pop());
        push(a);
      } else {
        a = pop() * pop();
        push(a);
      }
    }
    System.out.println(pop());
  } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String s = ""; s "" int a; a while(sc.hasNext()) {
      s = sc.next();
      if(isNum(s)) {
        push(Integer.parseInt(s));
      } else if(s.equals("+")) {
        a = pop() + pop();
        push(a);
      } else if(s.equals("-")) {
        a = - (pop() - pop());
        push(a);
      } else {
        a = pop() * pop();
        push(a);
      }
    } sc.hasNext() sc.hasNext sc {
      s = sc.next();
      if(isNum(s)) {
        push(Integer.parseInt(s));
      } else if(s.equals("+")) {
        a = pop() + pop();
        push(a);
      } else if(s.equals("-")) {
        a = - (pop() - pop());
        push(a);
      } else {
        a = pop() * pop();
        push(a);
      }
    } s = sc.next() s sc.next() sc.next sc if(isNum(s)) {
        push(Integer.parseInt(s));
      } else if(s.equals("+")) {
        a = pop() + pop();
        push(a);
      } else if(s.equals("-")) {
        a = - (pop() - pop());
        push(a);
      } else {
        a = pop() * pop();
        push(a);
      } isNum(s) isNum s {
        push(Integer.parseInt(s));
      } push(Integer.parseInt(s)) push Integer.parseInt(s) Integer.parseInt Integer s if(s.equals("+")) {
        a = pop() + pop();
        push(a);
      } else if(s.equals("-")) {
        a = - (pop() - pop());
        push(a);
      } else {
        a = pop() * pop();
        push(a);
      } s.equals("+") s.equals s "+" {
        a = pop() + pop();
        push(a);
      } a = pop() + pop() a pop() + pop() pop() pop pop() pop push(a) push a if(s.equals("-")) {
        a = - (pop() - pop());
        push(a);
      } else {
        a = pop() * pop();
        push(a);
      } s.equals("-") s.equals s "-" {
        a = - (pop() - pop());
        push(a);
      } a = - (pop() - pop()) a - (pop() - pop()) (pop() - pop()) pop() pop pop() pop push(a) push a {
        a = pop() * pop();
        push(a);
      } a = pop() * pop() a pop() * pop() pop() pop pop() pop push(a) push a System.out.println(pop()) System.out.println System.out System System.out pop() pop String[] args args public class Main {
  static int top = 0;
  static int max = 110;
  static int[] stack = new int[max];

  public static boolean isNum(String str) {
    try {
      Integer.parseInt(str);
      return true;
    } catch(NumberFormatException e) {
      return false;
    }
  }
  public static void initialize() {
    top = 0;
  }
  public static boolean isEmpty() {
    return top == 0;
  }
  public static boolean isFull() {
    return top >= max - 1;
  }
  public static void push(int x) {
    if(isFull()) {
      throw new IllegalArgumentException("オーバーフロー");
    } else {
      top++;
      stack[top] = x;
    }
  }
  public static int pop() {
    if(isEmpty()) {
      throw new IllegalArgumentException("アンダーフロー");
    } else {
      top--;
      return stack[top + 1];
    }
  }

  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    String s = "";
    int a;
    while(sc.hasNext()) {
      s = sc.next();
      if(isNum(s)) {
        push(Integer.parseInt(s));
      } else if(s.equals("+")) {
        a = pop() + pop();
        push(a);
      } else if(s.equals("-")) {
        a = - (pop() - pop());
        push(a);
      } else {
        a = pop() * pop();
        push(a);
      }
    }
    System.out.println(pop());
  }
} public class Main {
  static int top = 0;
  static int max = 110;
  static int[] stack = new int[max];

  public static boolean isNum(String str) {
    try {
      Integer.parseInt(str);
      return true;
    } catch(NumberFormatException e) {
      return false;
    }
  }
  public static void initialize() {
    top = 0;
  }
  public static boolean isEmpty() {
    return top == 0;
  }
  public static boolean isFull() {
    return top >= max - 1;
  }
  public static void push(int x) {
    if(isFull()) {
      throw new IllegalArgumentException("オーバーフロー");
    } else {
      top++;
      stack[top] = x;
    }
  }
  public static int pop() {
    if(isEmpty()) {
      throw new IllegalArgumentException("アンダーフロー");
    } else {
      top--;
      return stack[top + 1];
    }
  }

  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    String s = "";
    int a;
    while(sc.hasNext()) {
      s = sc.next();
      if(isNum(s)) {
        push(Integer.parseInt(s));
      } else if(s.equals("+")) {
        a = pop() + pop();
        push(a);
      } else if(s.equals("-")) {
        a = - (pop() - pop());
        push(a);
      } else {
        a = pop() * pop();
        push(a);
      }
    }
    System.out.println(pop());
  }
} Main
import java.util.*;

public class Main {
  static int top = 0;
  static int max = 110;
  static int[] stack = new int[max];

  public static boolean isNum(String str) {
    try {
      Integer.parseInt(str);
      return true;
    } catch(NumberFormatException e) {
      return false;
    }
  }
  public static void initialize() {
    top = 0;
  }
  public static boolean isEmpty() {
    return top == 0;
  }
  public static boolean isFull() {
    return top >= max - 1;
  }
  public static void push(int x) {
    if(isFull()) {
      throw new IllegalArgumentException("オーバーフロー");
    } else {
      top++;
      stack[top] = x;
    }
  }
  public static int pop() {
    if(isEmpty()) {
      throw new IllegalArgumentException("アンダーフロー");
    } else {
      top--;
      return stack[top + 1];
    }
  }

  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    String s = "";
    int a;
    while(sc.hasNext()) {
      s = sc.next();
      if(isNum(s)) {
        push(Integer.parseInt(s));
      } else if(s.equals("+")) {
        a = pop() + pop();
        push(a);
      } else if(s.equals("-")) {
        a = - (pop() - pop());
        push(a);
      } else {
        a = pop() * pop();
        push(a);
      }
    }
    System.out.println(pop());
  }
}

