import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Stack;

public class Main {
  public static void main(String[] args) throws IOException {
    BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
    String str = br.readLine();
    String[] stri = str.split(" ");
    Stack<Integer> st = new Stack<Integer>();
    for (int i = 0; i < stri.length; i++) {
      int i1, i2;
      switch (stri[i]) {
        case "+":
          i1 = st.pop();
          i2 = st.pop();
          st.push(i1 + i2);
          break;
        case "-":
          i1 = st.pop();
          i2 = st.pop();
          st.push(i2 - i1);
          break;
        case "*":
          i1 = st.pop();
          i2 = st.pop();
          st.push(i1 * i2);
          break;
        default:
          st.push(Integer.parseInt(stri[i]));
      }
    }
    System.out.println(st.pop());
  }
} import java.io.BufferedReader; BufferedReader java.io import java.io.IOException; IOException java.io import java.io.InputStreamReader; InputStreamReader java.io import java.util.Stack; Stack java.util public class Main {
  public static void main(String[] args) throws IOException {
    BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
    String str = br.readLine();
    String[] stri = str.split(" ");
    Stack<Integer> st = new Stack<Integer>();
    for (int i = 0; i < stri.length; i++) {
      int i1, i2;
      switch (stri[i]) {
        case "+":
          i1 = st.pop();
          i2 = st.pop();
          st.push(i1 + i2);
          break;
        case "-":
          i1 = st.pop();
          i2 = st.pop();
          st.push(i2 - i1);
          break;
        case "*":
          i1 = st.pop();
          i2 = st.pop();
          st.push(i1 * i2);
          break;
        default:
          st.push(Integer.parseInt(stri[i]));
      }
    }
    System.out.println(st.pop());
  }
} Main public static void main(String[] args) throws IOException {
    BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
    String str = br.readLine();
    String[] stri = str.split(" ");
    Stack<Integer> st = new Stack<Integer>();
    for (int i = 0; i < stri.length; i++) {
      int i1, i2;
      switch (stri[i]) {
        case "+":
          i1 = st.pop();
          i2 = st.pop();
          st.push(i1 + i2);
          break;
        case "-":
          i1 = st.pop();
          i2 = st.pop();
          st.push(i2 - i1);
          break;
        case "*":
          i1 = st.pop();
          i2 = st.pop();
          st.push(i1 * i2);
          break;
        default:
          st.push(Integer.parseInt(stri[i]));
      }
    }
    System.out.println(st.pop());
  } main {
    BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
    String str = br.readLine();
    String[] stri = str.split(" ");
    Stack<Integer> st = new Stack<Integer>();
    for (int i = 0; i < stri.length; i++) {
      int i1, i2;
      switch (stri[i]) {
        case "+":
          i1 = st.pop();
          i2 = st.pop();
          st.push(i1 + i2);
          break;
        case "-":
          i1 = st.pop();
          i2 = st.pop();
          st.push(i2 - i1);
          break;
        case "*":
          i1 = st.pop();
          i2 = st.pop();
          st.push(i1 * i2);
          break;
        default:
          st.push(Integer.parseInt(stri[i]));
      }
    }
    System.out.println(st.pop());
  } BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); br new BufferedReader(new InputStreamReader(System.in)) String str = br.readLine(); str br.readLine() br.readLine br String[] stri = str.split(" "); stri str.split(" ") str.split str " " Stack<Integer> st = new Stack<Integer>(); st new Stack<Integer>() for (int i = 0; i < stri.length; i++) {
      int i1, i2;
      switch (stri[i]) {
        case "+":
          i1 = st.pop();
          i2 = st.pop();
          st.push(i1 + i2);
          break;
        case "-":
          i1 = st.pop();
          i2 = st.pop();
          st.push(i2 - i1);
          break;
        case "*":
          i1 = st.pop();
          i2 = st.pop();
          st.push(i1 * i2);
          break;
        default:
          st.push(Integer.parseInt(stri[i]));
      }
    } int i = 0; int i = 0; i 0 i < stri.length i stri.length stri stri.length i++ i++ i {
      int i1, i2;
      switch (stri[i]) {
        case "+":
          i1 = st.pop();
          i2 = st.pop();
          st.push(i1 + i2);
          break;
        case "-":
          i1 = st.pop();
          i2 = st.pop();
          st.push(i2 - i1);
          break;
        case "*":
          i1 = st.pop();
          i2 = st.pop();
          st.push(i1 * i2);
          break;
        default:
          st.push(Integer.parseInt(stri[i]));
      }
    } {
      int i1, i2;
      switch (stri[i]) {
        case "+":
          i1 = st.pop();
          i2 = st.pop();
          st.push(i1 + i2);
          break;
        case "-":
          i1 = st.pop();
          i2 = st.pop();
          st.push(i2 - i1);
          break;
        case "*":
          i1 = st.pop();
          i2 = st.pop();
          st.push(i1 * i2);
          break;
        default:
          st.push(Integer.parseInt(stri[i]));
      }
    } int i1 i1 i2; i2 switch (stri[i]) {
        case "+":
          i1 = st.pop();
          i2 = st.pop();
          st.push(i1 + i2);
          break;
        case "-":
          i1 = st.pop();
          i2 = st.pop();
          st.push(i2 - i1);
          break;
        case "*":
          i1 = st.pop();
          i2 = st.pop();
          st.push(i1 * i2);
          break;
        default:
          st.push(Integer.parseInt(stri[i]));
      } stri[i] stri i case "+": "+" case "+": i1 = st.pop() i1 st.pop() st.pop st i2 = st.pop() i2 st.pop() st.pop st st.push(i1 + i2) st.push st i1 + i2 i1 i2 break; case "-": "-" case "-": i1 = st.pop() i1 st.pop() st.pop st i2 = st.pop() i2 st.pop() st.pop st st.push(i2 - i1) st.push st i2 - i1 i2 i1 break; case "*": "*" case "*": i1 = st.pop() i1 st.pop() st.pop st i2 = st.pop() i2 st.pop() st.pop st st.push(i1 * i2) st.push st i1 * i2 i1 i2 break; default: default: st.push(Integer.parseInt(stri[i])) st.push st Integer.parseInt(stri[i]) Integer.parseInt Integer stri[i] stri i System.out.println(st.pop()) System.out.println System.out System System.out st.pop() st.pop st String[] args args public class Main {
  public static void main(String[] args) throws IOException {
    BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
    String str = br.readLine();
    String[] stri = str.split(" ");
    Stack<Integer> st = new Stack<Integer>();
    for (int i = 0; i < stri.length; i++) {
      int i1, i2;
      switch (stri[i]) {
        case "+":
          i1 = st.pop();
          i2 = st.pop();
          st.push(i1 + i2);
          break;
        case "-":
          i1 = st.pop();
          i2 = st.pop();
          st.push(i2 - i1);
          break;
        case "*":
          i1 = st.pop();
          i2 = st.pop();
          st.push(i1 * i2);
          break;
        default:
          st.push(Integer.parseInt(stri[i]));
      }
    }
    System.out.println(st.pop());
  }
} public class Main {
  public static void main(String[] args) throws IOException {
    BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
    String str = br.readLine();
    String[] stri = str.split(" ");
    Stack<Integer> st = new Stack<Integer>();
    for (int i = 0; i < stri.length; i++) {
      int i1, i2;
      switch (stri[i]) {
        case "+":
          i1 = st.pop();
          i2 = st.pop();
          st.push(i1 + i2);
          break;
        case "-":
          i1 = st.pop();
          i2 = st.pop();
          st.push(i2 - i1);
          break;
        case "*":
          i1 = st.pop();
          i2 = st.pop();
          st.push(i1 * i2);
          break;
        default:
          st.push(Integer.parseInt(stri[i]));
      }
    }
    System.out.println(st.pop());
  }
} Main
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Stack;

public class Main {
  public static void main(String[] args) throws IOException {
    BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
    String str = br.readLine();
    String[] stri = str.split(" ");
    Stack<Integer> st = new Stack<Integer>();
    for (int i = 0; i < stri.length; i++) {
      int i1, i2;
      switch (stri[i]) {
        case "+":
          i1 = st.pop();
          i2 = st.pop();
          st.push(i1 + i2);
          break;
        case "-":
          i1 = st.pop();
          i2 = st.pop();
          st.push(i2 - i1);
          break;
        case "*":
          i1 = st.pop();
          i2 = st.pop();
          st.push(i1 * i2);
          break;
        default:
          st.push(Integer.parseInt(stri[i]));
      }
    }
    System.out.println(st.pop());
  }
}