import java.io.*;
import java.util.*;



public class Main{
    public static void main(String[] args)throws IOException{
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String str;

        str = br.readLine();//34 116 + 20 5 - 5 - 1 * +
        String[] strs = str.split("\\s");
        int[] stack = new int[200];

        int l = 0;
        for(int i=0;i<strs.length;i++){
            if(strs[i].equals("+")){
                l--;
                int x = stack[l+1];
                int y = stack[l];
                stack[l] =  x + y;
                //System.out.println(stack[l]);
            }else if(strs[i].equals("-")){
                l--;
                int x = stack[l+1];
                int y = stack[l];
                stack[l] =  y - x;
                //System.out.println(stack[l]);
            }else if(strs[i].equals("*")){
                l--;
                int x = stack[l+1];
                int y = stack[l];
                stack[l] = x * y;
                //System.out.println(stack[l]);
            }else{
                l++;
                stack[l] = Integer.parseInt(strs[i]);
            }
        }
        
        System.out.println(stack[l]);
        
        br.close();
    }
   
}
 import java.io.*; io.* java import java.util.*; util.* java public class Main{
    public static void main(String[] args)throws IOException{
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String str;

        str = br.readLine();//34 116 + 20 5 - 5 - 1 * +
        String[] strs = str.split("\\s");
        int[] stack = new int[200];

        int l = 0;
        for(int i=0;i<strs.length;i++){
            if(strs[i].equals("+")){
                l--;
                int x = stack[l+1];
                int y = stack[l];
                stack[l] =  x + y;
                //System.out.println(stack[l]);
            }else if(strs[i].equals("-")){
                l--;
                int x = stack[l+1];
                int y = stack[l];
                stack[l] =  y - x;
                //System.out.println(stack[l]);
            }else if(strs[i].equals("*")){
                l--;
                int x = stack[l+1];
                int y = stack[l];
                stack[l] = x * y;
                //System.out.println(stack[l]);
            }else{
                l++;
                stack[l] = Integer.parseInt(strs[i]);
            }
        }
        
        System.out.println(stack[l]);
        
        br.close();
    }
   
} Main public static void main(String[] args)throws IOException{
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String str;

        str = br.readLine();//34 116 + 20 5 - 5 - 1 * +
        String[] strs = str.split("\\s");
        int[] stack = new int[200];

        int l = 0;
        for(int i=0;i<strs.length;i++){
            if(strs[i].equals("+")){
                l--;
                int x = stack[l+1];
                int y = stack[l];
                stack[l] =  x + y;
                //System.out.println(stack[l]);
            }else if(strs[i].equals("-")){
                l--;
                int x = stack[l+1];
                int y = stack[l];
                stack[l] =  y - x;
                //System.out.println(stack[l]);
            }else if(strs[i].equals("*")){
                l--;
                int x = stack[l+1];
                int y = stack[l];
                stack[l] = x * y;
                //System.out.println(stack[l]);
            }else{
                l++;
                stack[l] = Integer.parseInt(strs[i]);
            }
        }
        
        System.out.println(stack[l]);
        
        br.close();
    } main {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String str;

        str = br.readLine();//34 116 + 20 5 - 5 - 1 * +
        String[] strs = str.split("\\s");
        int[] stack = new int[200];

        int l = 0;
        for(int i=0;i<strs.length;i++){
            if(strs[i].equals("+")){
                l--;
                int x = stack[l+1];
                int y = stack[l];
                stack[l] =  x + y;
                //System.out.println(stack[l]);
            }else if(strs[i].equals("-")){
                l--;
                int x = stack[l+1];
                int y = stack[l];
                stack[l] =  y - x;
                //System.out.println(stack[l]);
            }else if(strs[i].equals("*")){
                l--;
                int x = stack[l+1];
                int y = stack[l];
                stack[l] = x * y;
                //System.out.println(stack[l]);
            }else{
                l++;
                stack[l] = Integer.parseInt(strs[i]);
            }
        }
        
        System.out.println(stack[l]);
        
        br.close();
    } BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); br new BufferedReader(new InputStreamReader(System.in)) String str; str str = br.readLine() str br.readLine() br.readLine br String[] strs = str.split("\\s"); strs str.split("\\s") str.split str "\\s" int[] stack = new int[200]; stack new int[200] 200 int l = 0; l 0 for(int i=0;i<strs.length;i++){
            if(strs[i].equals("+")){
                l--;
                int x = stack[l+1];
                int y = stack[l];
                stack[l] =  x + y;
                //System.out.println(stack[l]);
            }else if(strs[i].equals("-")){
                l--;
                int x = stack[l+1];
                int y = stack[l];
                stack[l] =  y - x;
                //System.out.println(stack[l]);
            }else if(strs[i].equals("*")){
                l--;
                int x = stack[l+1];
                int y = stack[l];
                stack[l] = x * y;
                //System.out.println(stack[l]);
            }else{
                l++;
                stack[l] = Integer.parseInt(strs[i]);
            }
        } int i=0; int i=0; i 0 i<strs.length i strs.length strs strs.length i++ i++ i {
            if(strs[i].equals("+")){
                l--;
                int x = stack[l+1];
                int y = stack[l];
                stack[l] =  x + y;
                //System.out.println(stack[l]);
            }else if(strs[i].equals("-")){
                l--;
                int x = stack[l+1];
                int y = stack[l];
                stack[l] =  y - x;
                //System.out.println(stack[l]);
            }else if(strs[i].equals("*")){
                l--;
                int x = stack[l+1];
                int y = stack[l];
                stack[l] = x * y;
                //System.out.println(stack[l]);
            }else{
                l++;
                stack[l] = Integer.parseInt(strs[i]);
            }
        } {
            if(strs[i].equals("+")){
                l--;
                int x = stack[l+1];
                int y = stack[l];
                stack[l] =  x + y;
                //System.out.println(stack[l]);
            }else if(strs[i].equals("-")){
                l--;
                int x = stack[l+1];
                int y = stack[l];
                stack[l] =  y - x;
                //System.out.println(stack[l]);
            }else if(strs[i].equals("*")){
                l--;
                int x = stack[l+1];
                int y = stack[l];
                stack[l] = x * y;
                //System.out.println(stack[l]);
            }else{
                l++;
                stack[l] = Integer.parseInt(strs[i]);
            }
        } if(strs[i].equals("+")){
                l--;
                int x = stack[l+1];
                int y = stack[l];
                stack[l] =  x + y;
                //System.out.println(stack[l]);
            }else if(strs[i].equals("-")){
                l--;
                int x = stack[l+1];
                int y = stack[l];
                stack[l] =  y - x;
                //System.out.println(stack[l]);
            }else if(strs[i].equals("*")){
                l--;
                int x = stack[l+1];
                int y = stack[l];
                stack[l] = x * y;
                //System.out.println(stack[l]);
            }else{
                l++;
                stack[l] = Integer.parseInt(strs[i]);
            } strs[i].equals("+") strs[i].equals strs[i] strs i "+" {
                l--;
                int x = stack[l+1];
                int y = stack[l];
                stack[l] =  x + y;
                //System.out.println(stack[l]);
            } l-- l int x = stack[l+1]; x stack[l+1] stack l+1 l 1 int y = stack[l]; y stack[l] stack l stack[l] =  x + y stack[l] stack l x + y x y if(strs[i].equals("-")){
                l--;
                int x = stack[l+1];
                int y = stack[l];
                stack[l] =  y - x;
                //System.out.println(stack[l]);
            }else if(strs[i].equals("*")){
                l--;
                int x = stack[l+1];
                int y = stack[l];
                stack[l] = x * y;
                //System.out.println(stack[l]);
            }else{
                l++;
                stack[l] = Integer.parseInt(strs[i]);
            } strs[i].equals("-") strs[i].equals strs[i] strs i "-" {
                l--;
                int x = stack[l+1];
                int y = stack[l];
                stack[l] =  y - x;
                //System.out.println(stack[l]);
            } l-- l int x = stack[l+1]; x stack[l+1] stack l+1 l 1 int y = stack[l]; y stack[l] stack l stack[l] =  y - x stack[l] stack l y - x y x if(strs[i].equals("*")){
                l--;
                int x = stack[l+1];
                int y = stack[l];
                stack[l] = x * y;
                //System.out.println(stack[l]);
            }else{
                l++;
                stack[l] = Integer.parseInt(strs[i]);
            } strs[i].equals("*") strs[i].equals strs[i] strs i "*" {
                l--;
                int x = stack[l+1];
                int y = stack[l];
                stack[l] = x * y;
                //System.out.println(stack[l]);
            } l-- l int x = stack[l+1]; x stack[l+1] stack l+1 l 1 int y = stack[l]; y stack[l] stack l stack[l] = x * y stack[l] stack l x * y x y {
                l++;
                stack[l] = Integer.parseInt(strs[i]);
            } l++ l stack[l] = Integer.parseInt(strs[i]) stack[l] stack l Integer.parseInt(strs[i]) Integer.parseInt Integer strs[i] strs i System.out.println(stack[l]) System.out.println System.out System System.out stack[l] stack l br.close() br.close br String[] args args public class Main{
    public static void main(String[] args)throws IOException{
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String str;

        str = br.readLine();//34 116 + 20 5 - 5 - 1 * +
        String[] strs = str.split("\\s");
        int[] stack = new int[200];

        int l = 0;
        for(int i=0;i<strs.length;i++){
            if(strs[i].equals("+")){
                l--;
                int x = stack[l+1];
                int y = stack[l];
                stack[l] =  x + y;
                //System.out.println(stack[l]);
            }else if(strs[i].equals("-")){
                l--;
                int x = stack[l+1];
                int y = stack[l];
                stack[l] =  y - x;
                //System.out.println(stack[l]);
            }else if(strs[i].equals("*")){
                l--;
                int x = stack[l+1];
                int y = stack[l];
                stack[l] = x * y;
                //System.out.println(stack[l]);
            }else{
                l++;
                stack[l] = Integer.parseInt(strs[i]);
            }
        }
        
        System.out.println(stack[l]);
        
        br.close();
    }
   
} public class Main{
    public static void main(String[] args)throws IOException{
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String str;

        str = br.readLine();//34 116 + 20 5 - 5 - 1 * +
        String[] strs = str.split("\\s");
        int[] stack = new int[200];

        int l = 0;
        for(int i=0;i<strs.length;i++){
            if(strs[i].equals("+")){
                l--;
                int x = stack[l+1];
                int y = stack[l];
                stack[l] =  x + y;
                //System.out.println(stack[l]);
            }else if(strs[i].equals("-")){
                l--;
                int x = stack[l+1];
                int y = stack[l];
                stack[l] =  y - x;
                //System.out.println(stack[l]);
            }else if(strs[i].equals("*")){
                l--;
                int x = stack[l+1];
                int y = stack[l];
                stack[l] = x * y;
                //System.out.println(stack[l]);
            }else{
                l++;
                stack[l] = Integer.parseInt(strs[i]);
            }
        }
        
        System.out.println(stack[l]);
        
        br.close();
    }
   
} Main
import java.io.*;
import java.util.*;



public class Main{
    public static void main(String[] args)throws IOException{
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String str;

        str = br.readLine();//34 116 + 20 5 - 5 - 1 * +
        String[] strs = str.split("\\s");
        int[] stack = new int[200];

        int l = 0;
        for(int i=0;i<strs.length;i++){
            if(strs[i].equals("+")){
                l--;
                int x = stack[l+1];
                int y = stack[l];
                stack[l] =  x + y;
                //System.out.println(stack[l]);
            }else if(strs[i].equals("-")){
                l--;
                int x = stack[l+1];
                int y = stack[l];
                stack[l] =  y - x;
                //System.out.println(stack[l]);
            }else if(strs[i].equals("*")){
                l--;
                int x = stack[l+1];
                int y = stack[l];
                stack[l] = x * y;
                //System.out.println(stack[l]);
            }else{
                l++;
                stack[l] = Integer.parseInt(strs[i]);
            }
        }
        
        System.out.println(stack[l]);
        
        br.close();
    }
   
}

