import java.util.Scanner;
import java.lang.Math;
import java.lang.System;
import java.io.*;
class Main{

  private static int top;
  private static String[] s=new String[1000];

  public static void initialize(){
    top=0;
    return;
  }

  public static boolean isEmpty(){
    if(top==0)
      return true;
    return false;
  }

  public static boolean isFull(){
    if(top>=1000)
      return true;
    return false;
  }

  public static void push(String str){
    if(isFull()) System.out.println("Error");
    s[++top]=str;
  }

  public static String pop(){
    if(isEmpty()) System.out.println("Error");
    return s[top--];
  }

  public static void main(String args[]) throws Exception{
    try (BufferedReader br = new BufferedReader(new InputStreamReader(System.in))) {
      String line= br.readLine();
      int a,b;
      s[0]=null;

      //while ((line = br.readLine()) != null) {
        //System.out.println(line);
        String[] str = line.split(" ");
        for(int i=0;i<str.length;i++){
          //System.out.println(str[i]);
          if(str[i].equals("+")){
            b=Integer.parseInt(pop());
            a=Integer.parseInt(pop());
            push(String.valueOf(a+b));
            //System.out.println(a+b);
          }
          else if(str[i].equals("-")){
            b=Integer.parseInt(pop());
            a=Integer.parseInt(pop());
            push(String.valueOf(a-b));
            //System.out.println(a-b);
          }
          else if(str[i].equals("*")){
            b=Integer.parseInt(pop());
            a=Integer.parseInt(pop());
            push(String.valueOf(a*b));
            //System.out.println(a*b);
          }
          else{
            push(str[i]);
          }
        }

      //System.out.println("done");
      }
      //System.out.println("done");
      String answer=pop();
      System.out.println(answer);
    //}
  }
}
 import java.util.Scanner; Scanner java.util import java.lang.Math; Math java.lang import java.lang.System; System java.lang import java.io.*; io.* java class Main{

  private static int top;
  private static String[] s=new String[1000];

  public static void initialize(){
    top=0;
    return;
  }

  public static boolean isEmpty(){
    if(top==0)
      return true;
    return false;
  }

  public static boolean isFull(){
    if(top>=1000)
      return true;
    return false;
  }

  public static void push(String str){
    if(isFull()) System.out.println("Error");
    s[++top]=str;
  }

  public static String pop(){
    if(isEmpty()) System.out.println("Error");
    return s[top--];
  }

  public static void main(String args[]) throws Exception{
    try (BufferedReader br = new BufferedReader(new InputStreamReader(System.in))) {
      String line= br.readLine();
      int a,b;
      s[0]=null;

      //while ((line = br.readLine()) != null) {
        //System.out.println(line);
        String[] str = line.split(" ");
        for(int i=0;i<str.length;i++){
          //System.out.println(str[i]);
          if(str[i].equals("+")){
            b=Integer.parseInt(pop());
            a=Integer.parseInt(pop());
            push(String.valueOf(a+b));
            //System.out.println(a+b);
          }
          else if(str[i].equals("-")){
            b=Integer.parseInt(pop());
            a=Integer.parseInt(pop());
            push(String.valueOf(a-b));
            //System.out.println(a-b);
          }
          else if(str[i].equals("*")){
            b=Integer.parseInt(pop());
            a=Integer.parseInt(pop());
            push(String.valueOf(a*b));
            //System.out.println(a*b);
          }
          else{
            push(str[i]);
          }
        }

      //System.out.println("done");
      }
      //System.out.println("done");
      String answer=pop();
      System.out.println(answer);
    //}
  }
} Main private static int top; top private static String[] s=new String[1000]; s new String[1000] 1000 public static void initialize(){
    top=0;
    return;
  } initialize {
    top=0;
    return;
  } top=0 top 0 return; public static boolean isEmpty(){
    if(top==0)
      return true;
    return false;
  } isEmpty {
    if(top==0)
      return true;
    return false;
  } if(top==0)
      return true; top==0 top 0 return true; true return false; false public static boolean isFull(){
    if(top>=1000)
      return true;
    return false;
  } isFull {
    if(top>=1000)
      return true;
    return false;
  } if(top>=1000)
      return true; top>=1000 top 1000 return true; true return false; false public static void push(String str){
    if(isFull()) System.out.println("Error");
    s[++top]=str;
  } push {
    if(isFull()) System.out.println("Error");
    s[++top]=str;
  } if(isFull()) System.out.println("Error"); isFull() isFull System.out.println("Error") System.out.println System.out System System.out "Error" s[++top]=str s[++top] s ++top top str String str str public static String pop(){
    if(isEmpty()) System.out.println("Error");
    return s[top--];
  } pop {
    if(isEmpty()) System.out.println("Error");
    return s[top--];
  } if(isEmpty()) System.out.println("Error"); isEmpty() isEmpty System.out.println("Error") System.out.println System.out System System.out "Error" return s[top--]; s[top--] s top-- top public static void main(String args[]) throws Exception{
    try (BufferedReader br = new BufferedReader(new InputStreamReader(System.in))) {
      String line= br.readLine();
      int a,b;
      s[0]=null;

      //while ((line = br.readLine()) != null) {
        //System.out.println(line);
        String[] str = line.split(" ");
        for(int i=0;i<str.length;i++){
          //System.out.println(str[i]);
          if(str[i].equals("+")){
            b=Integer.parseInt(pop());
            a=Integer.parseInt(pop());
            push(String.valueOf(a+b));
            //System.out.println(a+b);
          }
          else if(str[i].equals("-")){
            b=Integer.parseInt(pop());
            a=Integer.parseInt(pop());
            push(String.valueOf(a-b));
            //System.out.println(a-b);
          }
          else if(str[i].equals("*")){
            b=Integer.parseInt(pop());
            a=Integer.parseInt(pop());
            push(String.valueOf(a*b));
            //System.out.println(a*b);
          }
          else{
            push(str[i]);
          }
        }

      //System.out.println("done");
      }
      //System.out.println("done");
      String answer=pop();
      System.out.println(answer);
    //}
  } main {
    try (BufferedReader br = new BufferedReader(new InputStreamReader(System.in))) {
      String line= br.readLine();
      int a,b;
      s[0]=null;

      //while ((line = br.readLine()) != null) {
        //System.out.println(line);
        String[] str = line.split(" ");
        for(int i=0;i<str.length;i++){
          //System.out.println(str[i]);
          if(str[i].equals("+")){
            b=Integer.parseInt(pop());
            a=Integer.parseInt(pop());
            push(String.valueOf(a+b));
            //System.out.println(a+b);
          }
          else if(str[i].equals("-")){
            b=Integer.parseInt(pop());
            a=Integer.parseInt(pop());
            push(String.valueOf(a-b));
            //System.out.println(a-b);
          }
          else if(str[i].equals("*")){
            b=Integer.parseInt(pop());
            a=Integer.parseInt(pop());
            push(String.valueOf(a*b));
            //System.out.println(a*b);
          }
          else{
            push(str[i]);
          }
        }

      //System.out.println("done");
      }
      //System.out.println("done");
      String answer=pop();
      System.out.println(answer);
    //}
  } try (BufferedReader br = new BufferedReader(new InputStreamReader(System.in))) {
      String line= br.readLine();
      int a,b;
      s[0]=null;

      //while ((line = br.readLine()) != null) {
        //System.out.println(line);
        String[] str = line.split(" ");
        for(int i=0;i<str.length;i++){
          //System.out.println(str[i]);
          if(str[i].equals("+")){
            b=Integer.parseInt(pop());
            a=Integer.parseInt(pop());
            push(String.valueOf(a+b));
            //System.out.println(a+b);
          }
          else if(str[i].equals("-")){
            b=Integer.parseInt(pop());
            a=Integer.parseInt(pop());
            push(String.valueOf(a-b));
            //System.out.println(a-b);
          }
          else if(str[i].equals("*")){
            b=Integer.parseInt(pop());
            a=Integer.parseInt(pop());
            push(String.valueOf(a*b));
            //System.out.println(a*b);
          }
          else{
            push(str[i]);
          }
        }

      //System.out.println("done");
      } {
      String line= br.readLine();
      int a,b;
      s[0]=null;

      //while ((line = br.readLine()) != null) {
        //System.out.println(line);
        String[] str = line.split(" ");
        for(int i=0;i<str.length;i++){
          //System.out.println(str[i]);
          if(str[i].equals("+")){
            b=Integer.parseInt(pop());
            a=Integer.parseInt(pop());
            push(String.valueOf(a+b));
            //System.out.println(a+b);
          }
          else if(str[i].equals("-")){
            b=Integer.parseInt(pop());
            a=Integer.parseInt(pop());
            push(String.valueOf(a-b));
            //System.out.println(a-b);
          }
          else if(str[i].equals("*")){
            b=Integer.parseInt(pop());
            a=Integer.parseInt(pop());
            push(String.valueOf(a*b));
            //System.out.println(a*b);
          }
          else{
            push(str[i]);
          }
        }

      //System.out.println("done");
      } BufferedReader br = new BufferedReader(new InputStreamReader(System.in)) BufferedReader br = new BufferedReader(new InputStreamReader(System.in)) new BufferedReader(new InputStreamReader(System.in)) String line= br.readLine(); line br.readLine() br.readLine br int a a b; b s[0]=null s[0] s 0 null String[] str = line.split(" "); str line.split(" ") line.split line " " for(int i=0;i<str.length;i++){
          //System.out.println(str[i]);
          if(str[i].equals("+")){
            b=Integer.parseInt(pop());
            a=Integer.parseInt(pop());
            push(String.valueOf(a+b));
            //System.out.println(a+b);
          }
          else if(str[i].equals("-")){
            b=Integer.parseInt(pop());
            a=Integer.parseInt(pop());
            push(String.valueOf(a-b));
            //System.out.println(a-b);
          }
          else if(str[i].equals("*")){
            b=Integer.parseInt(pop());
            a=Integer.parseInt(pop());
            push(String.valueOf(a*b));
            //System.out.println(a*b);
          }
          else{
            push(str[i]);
          }
        } int i=0; int i=0; i 0 i<str.length i str.length str str.length i++ i++ i {
          //System.out.println(str[i]);
          if(str[i].equals("+")){
            b=Integer.parseInt(pop());
            a=Integer.parseInt(pop());
            push(String.valueOf(a+b));
            //System.out.println(a+b);
          }
          else if(str[i].equals("-")){
            b=Integer.parseInt(pop());
            a=Integer.parseInt(pop());
            push(String.valueOf(a-b));
            //System.out.println(a-b);
          }
          else if(str[i].equals("*")){
            b=Integer.parseInt(pop());
            a=Integer.parseInt(pop());
            push(String.valueOf(a*b));
            //System.out.println(a*b);
          }
          else{
            push(str[i]);
          }
        } {
          //System.out.println(str[i]);
          if(str[i].equals("+")){
            b=Integer.parseInt(pop());
            a=Integer.parseInt(pop());
            push(String.valueOf(a+b));
            //System.out.println(a+b);
          }
          else if(str[i].equals("-")){
            b=Integer.parseInt(pop());
            a=Integer.parseInt(pop());
            push(String.valueOf(a-b));
            //System.out.println(a-b);
          }
          else if(str[i].equals("*")){
            b=Integer.parseInt(pop());
            a=Integer.parseInt(pop());
            push(String.valueOf(a*b));
            //System.out.println(a*b);
          }
          else{
            push(str[i]);
          }
        } if(str[i].equals("+")){
            b=Integer.parseInt(pop());
            a=Integer.parseInt(pop());
            push(String.valueOf(a+b));
            //System.out.println(a+b);
          }
          else if(str[i].equals("-")){
            b=Integer.parseInt(pop());
            a=Integer.parseInt(pop());
            push(String.valueOf(a-b));
            //System.out.println(a-b);
          }
          else if(str[i].equals("*")){
            b=Integer.parseInt(pop());
            a=Integer.parseInt(pop());
            push(String.valueOf(a*b));
            //System.out.println(a*b);
          }
          else{
            push(str[i]);
          } str[i].equals("+") str[i].equals str[i] str i "+" {
            b=Integer.parseInt(pop());
            a=Integer.parseInt(pop());
            push(String.valueOf(a+b));
            //System.out.println(a+b);
          } b=Integer.parseInt(pop()) b Integer.parseInt(pop()) Integer.parseInt Integer pop() pop a=Integer.parseInt(pop()) a Integer.parseInt(pop()) Integer.parseInt Integer pop() pop push(String.valueOf(a+b)) push String.valueOf(a+b) String.valueOf String a+b a b if(str[i].equals("-")){
            b=Integer.parseInt(pop());
            a=Integer.parseInt(pop());
            push(String.valueOf(a-b));
            //System.out.println(a-b);
          }
          else if(str[i].equals("*")){
            b=Integer.parseInt(pop());
            a=Integer.parseInt(pop());
            push(String.valueOf(a*b));
            //System.out.println(a*b);
          }
          else{
            push(str[i]);
          } str[i].equals("-") str[i].equals str[i] str i "-" {
            b=Integer.parseInt(pop());
            a=Integer.parseInt(pop());
            push(String.valueOf(a-b));
            //System.out.println(a-b);
          } b=Integer.parseInt(pop()) b Integer.parseInt(pop()) Integer.parseInt Integer pop() pop a=Integer.parseInt(pop()) a Integer.parseInt(pop()) Integer.parseInt Integer pop() pop push(String.valueOf(a-b)) push String.valueOf(a-b) String.valueOf String a-b a b if(str[i].equals("*")){
            b=Integer.parseInt(pop());
            a=Integer.parseInt(pop());
            push(String.valueOf(a*b));
            //System.out.println(a*b);
          }
          else{
            push(str[i]);
          } str[i].equals("*") str[i].equals str[i] str i "*" {
            b=Integer.parseInt(pop());
            a=Integer.parseInt(pop());
            push(String.valueOf(a*b));
            //System.out.println(a*b);
          } b=Integer.parseInt(pop()) b Integer.parseInt(pop()) Integer.parseInt Integer pop() pop a=Integer.parseInt(pop()) a Integer.parseInt(pop()) Integer.parseInt Integer pop() pop push(String.valueOf(a*b)) push String.valueOf(a*b) String.valueOf String a*b a b {
            push(str[i]);
          } push(str[i]) push str[i] str i String answer=pop(); answer pop() pop System.out.println(answer) System.out.println System.out System System.out answer String args[] args
import java.util.Scanner;
import java.lang.Math;
import java.lang.System;
import java.io.*;
class Main{

  private static int top;
  private static String[] s=new String[1000];

  public static void initialize(){
    top=0;
    return;
  }

  public static boolean isEmpty(){
    if(top==0)
      return true;
    return false;
  }

  public static boolean isFull(){
    if(top>=1000)
      return true;
    return false;
  }

  public static void push(String str){
    if(isFull()) System.out.println("Error");
    s[++top]=str;
  }

  public static String pop(){
    if(isEmpty()) System.out.println("Error");
    return s[top--];
  }

  public static void main(String args[]) throws Exception{
    try (BufferedReader br = new BufferedReader(new InputStreamReader(System.in))) {
      String line= br.readLine();
      int a,b;
      s[0]=null;

      //while ((line = br.readLine()) != null) {
        //System.out.println(line);
        String[] str = line.split(" ");
        for(int i=0;i<str.length;i++){
          //System.out.println(str[i]);
          if(str[i].equals("+")){
            b=Integer.parseInt(pop());
            a=Integer.parseInt(pop());
            push(String.valueOf(a+b));
            //System.out.println(a+b);
          }
          else if(str[i].equals("-")){
            b=Integer.parseInt(pop());
            a=Integer.parseInt(pop());
            push(String.valueOf(a-b));
            //System.out.println(a-b);
          }
          else if(str[i].equals("*")){
            b=Integer.parseInt(pop());
            a=Integer.parseInt(pop());
            push(String.valueOf(a*b));
            //System.out.println(a*b);
          }
          else{
            push(str[i]);
          }
        }

      //System.out.println("done");
      }
      //System.out.println("done");
      String answer=pop();
      System.out.println(answer);
    //}
  }
}

