import java.util.*;

class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);

        String str = sc.nextLine();
        String[] str_split = str.split(" ",0);

        int[] nums = new int[str_split.length];
        int top = 0;

        for(int i = 0;i < str_split.length;i++){
            switch(str_split[i].charAt(0)){
                case '+':
                    top--;
                    nums[top - 1] = nums[top - 1] + nums[top];
                    break;
                case '-':
                    top--;
                    nums[top - 1] = nums[top - 1] - nums[top];
                    break;
                case '*':
                    top--;
                    nums[top - 1] = nums[top - 1] * nums[top];
                    break;
                default:
                    nums[top] = Integer.parseInt(str_split[i]);
                    top++;
                    break;
            }
        }
        System.out.println(nums[0]);
    }
} import java.util.*; util.* java class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);

        String str = sc.nextLine();
        String[] str_split = str.split(" ",0);

        int[] nums = new int[str_split.length];
        int top = 0;

        for(int i = 0;i < str_split.length;i++){
            switch(str_split[i].charAt(0)){
                case '+':
                    top--;
                    nums[top - 1] = nums[top - 1] + nums[top];
                    break;
                case '-':
                    top--;
                    nums[top - 1] = nums[top - 1] - nums[top];
                    break;
                case '*':
                    top--;
                    nums[top - 1] = nums[top - 1] * nums[top];
                    break;
                default:
                    nums[top] = Integer.parseInt(str_split[i]);
                    top++;
                    break;
            }
        }
        System.out.println(nums[0]);
    }
} Main public static void main(String[] args){
        Scanner sc = new Scanner(System.in);

        String str = sc.nextLine();
        String[] str_split = str.split(" ",0);

        int[] nums = new int[str_split.length];
        int top = 0;

        for(int i = 0;i < str_split.length;i++){
            switch(str_split[i].charAt(0)){
                case '+':
                    top--;
                    nums[top - 1] = nums[top - 1] + nums[top];
                    break;
                case '-':
                    top--;
                    nums[top - 1] = nums[top - 1] - nums[top];
                    break;
                case '*':
                    top--;
                    nums[top - 1] = nums[top - 1] * nums[top];
                    break;
                default:
                    nums[top] = Integer.parseInt(str_split[i]);
                    top++;
                    break;
            }
        }
        System.out.println(nums[0]);
    } main {
        Scanner sc = new Scanner(System.in);

        String str = sc.nextLine();
        String[] str_split = str.split(" ",0);

        int[] nums = new int[str_split.length];
        int top = 0;

        for(int i = 0;i < str_split.length;i++){
            switch(str_split[i].charAt(0)){
                case '+':
                    top--;
                    nums[top - 1] = nums[top - 1] + nums[top];
                    break;
                case '-':
                    top--;
                    nums[top - 1] = nums[top - 1] - nums[top];
                    break;
                case '*':
                    top--;
                    nums[top - 1] = nums[top - 1] * nums[top];
                    break;
                default:
                    nums[top] = Integer.parseInt(str_split[i]);
                    top++;
                    break;
            }
        }
        System.out.println(nums[0]);
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String str = sc.nextLine(); str sc.nextLine() sc.nextLine sc String[] str_split = str.split(" ",0); str_split str.split(" ",0) str.split str " " 0 int[] nums = new int[str_split.length]; nums new int[str_split.length] str_split.length str_split str_split.length int top = 0; top 0 for(int i = 0;i < str_split.length;i++){
            switch(str_split[i].charAt(0)){
                case '+':
                    top--;
                    nums[top - 1] = nums[top - 1] + nums[top];
                    break;
                case '-':
                    top--;
                    nums[top - 1] = nums[top - 1] - nums[top];
                    break;
                case '*':
                    top--;
                    nums[top - 1] = nums[top - 1] * nums[top];
                    break;
                default:
                    nums[top] = Integer.parseInt(str_split[i]);
                    top++;
                    break;
            }
        } int i = 0; int i = 0; i 0 i < str_split.length i str_split.length str_split str_split.length i++ i++ i {
            switch(str_split[i].charAt(0)){
                case '+':
                    top--;
                    nums[top - 1] = nums[top - 1] + nums[top];
                    break;
                case '-':
                    top--;
                    nums[top - 1] = nums[top - 1] - nums[top];
                    break;
                case '*':
                    top--;
                    nums[top - 1] = nums[top - 1] * nums[top];
                    break;
                default:
                    nums[top] = Integer.parseInt(str_split[i]);
                    top++;
                    break;
            }
        } {
            switch(str_split[i].charAt(0)){
                case '+':
                    top--;
                    nums[top - 1] = nums[top - 1] + nums[top];
                    break;
                case '-':
                    top--;
                    nums[top - 1] = nums[top - 1] - nums[top];
                    break;
                case '*':
                    top--;
                    nums[top - 1] = nums[top - 1] * nums[top];
                    break;
                default:
                    nums[top] = Integer.parseInt(str_split[i]);
                    top++;
                    break;
            }
        } switch(str_split[i].charAt(0)){
                case '+':
                    top--;
                    nums[top - 1] = nums[top - 1] + nums[top];
                    break;
                case '-':
                    top--;
                    nums[top - 1] = nums[top - 1] - nums[top];
                    break;
                case '*':
                    top--;
                    nums[top - 1] = nums[top - 1] * nums[top];
                    break;
                default:
                    nums[top] = Integer.parseInt(str_split[i]);
                    top++;
                    break;
            } str_split[i].charAt(0) str_split[i].charAt str_split[i] str_split i 0 case '+': '+' case '+': top-- top nums[top - 1] = nums[top - 1] + nums[top] nums[top - 1] nums top - 1 top 1 nums[top - 1] + nums[top] nums[top - 1] nums top - 1 top 1 nums[top] nums top break; case '-': '-' case '-': top-- top nums[top - 1] = nums[top - 1] - nums[top] nums[top - 1] nums top - 1 top 1 nums[top - 1] - nums[top] nums[top - 1] nums top - 1 top 1 nums[top] nums top break; case '*': '*' case '*': top-- top nums[top - 1] = nums[top - 1] * nums[top] nums[top - 1] nums top - 1 top 1 nums[top - 1] * nums[top] nums[top - 1] nums top - 1 top 1 nums[top] nums top break; default: default: nums[top] = Integer.parseInt(str_split[i]) nums[top] nums top Integer.parseInt(str_split[i]) Integer.parseInt Integer str_split[i] str_split i top++ top break; System.out.println(nums[0]) System.out.println System.out System System.out nums[0] nums 0 String[] args args
import java.util.*;

class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);

        String str = sc.nextLine();
        String[] str_split = str.split(" ",0);

        int[] nums = new int[str_split.length];
        int top = 0;

        for(int i = 0;i < str_split.length;i++){
            switch(str_split[i].charAt(0)){
                case '+':
                    top--;
                    nums[top - 1] = nums[top - 1] + nums[top];
                    break;
                case '-':
                    top--;
                    nums[top - 1] = nums[top - 1] - nums[top];
                    break;
                case '*':
                    top--;
                    nums[top - 1] = nums[top - 1] * nums[top];
                    break;
                default:
                    nums[top] = Integer.parseInt(str_split[i]);
                    top++;
                    break;
            }
        }
        System.out.println(nums[0]);
    }
}
