import java.util.ArrayDeque;
import java.util.Deque;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String[] s = sc.nextLine().split(" ");
        Deque<Integer> deq = new ArrayDeque<Integer>();
        
        for (int i = 0; i < s.length; i++) {
            char ch = s[i].charAt(0);
            if (ch == '+' || ch == '-' || ch == '*') {
                int o2 = deq.pop();
                int o1 = deq.pop();
                
                deq.push((ch == '+') ? o1 + o2 : (ch == '-') ? o1 - o2 : o1 * o2);
                
            } else {
                deq.push(Integer.parseInt(s[i]));
            }
        }
        
        System.out.println(deq.pop());
    }
} import java.util.ArrayDeque; ArrayDeque java.util import java.util.Deque; Deque java.util import java.util.Scanner; Scanner java.util public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String[] s = sc.nextLine().split(" ");
        Deque<Integer> deq = new ArrayDeque<Integer>();
        
        for (int i = 0; i < s.length; i++) {
            char ch = s[i].charAt(0);
            if (ch == '+' || ch == '-' || ch == '*') {
                int o2 = deq.pop();
                int o1 = deq.pop();
                
                deq.push((ch == '+') ? o1 + o2 : (ch == '-') ? o1 - o2 : o1 * o2);
                
            } else {
                deq.push(Integer.parseInt(s[i]));
            }
        }
        
        System.out.println(deq.pop());
    }
} Main public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String[] s = sc.nextLine().split(" ");
        Deque<Integer> deq = new ArrayDeque<Integer>();
        
        for (int i = 0; i < s.length; i++) {
            char ch = s[i].charAt(0);
            if (ch == '+' || ch == '-' || ch == '*') {
                int o2 = deq.pop();
                int o1 = deq.pop();
                
                deq.push((ch == '+') ? o1 + o2 : (ch == '-') ? o1 - o2 : o1 * o2);
                
            } else {
                deq.push(Integer.parseInt(s[i]));
            }
        }
        
        System.out.println(deq.pop());
    } main {
        Scanner sc = new Scanner(System.in);
        String[] s = sc.nextLine().split(" ");
        Deque<Integer> deq = new ArrayDeque<Integer>();
        
        for (int i = 0; i < s.length; i++) {
            char ch = s[i].charAt(0);
            if (ch == '+' || ch == '-' || ch == '*') {
                int o2 = deq.pop();
                int o1 = deq.pop();
                
                deq.push((ch == '+') ? o1 + o2 : (ch == '-') ? o1 - o2 : o1 * o2);
                
            } else {
                deq.push(Integer.parseInt(s[i]));
            }
        }
        
        System.out.println(deq.pop());
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String[] s = sc.nextLine().split(" "); s sc.nextLine().split(" ") sc.nextLine().split sc.nextLine() sc.nextLine sc " " Deque<Integer> deq = new ArrayDeque<Integer>(); deq new ArrayDeque<Integer>() for (int i = 0; i < s.length; i++) {
            char ch = s[i].charAt(0);
            if (ch == '+' || ch == '-' || ch == '*') {
                int o2 = deq.pop();
                int o1 = deq.pop();
                
                deq.push((ch == '+') ? o1 + o2 : (ch == '-') ? o1 - o2 : o1 * o2);
                
            } else {
                deq.push(Integer.parseInt(s[i]));
            }
        } int i = 0; int i = 0; i 0 i < s.length i s.length s s.length i++ i++ i {
            char ch = s[i].charAt(0);
            if (ch == '+' || ch == '-' || ch == '*') {
                int o2 = deq.pop();
                int o1 = deq.pop();
                
                deq.push((ch == '+') ? o1 + o2 : (ch == '-') ? o1 - o2 : o1 * o2);
                
            } else {
                deq.push(Integer.parseInt(s[i]));
            }
        } {
            char ch = s[i].charAt(0);
            if (ch == '+' || ch == '-' || ch == '*') {
                int o2 = deq.pop();
                int o1 = deq.pop();
                
                deq.push((ch == '+') ? o1 + o2 : (ch == '-') ? o1 - o2 : o1 * o2);
                
            } else {
                deq.push(Integer.parseInt(s[i]));
            }
        } char ch = s[i].charAt(0); ch s[i].charAt(0) s[i].charAt s[i] s i 0 if (ch == '+' || ch == '-' || ch == '*') {
                int o2 = deq.pop();
                int o1 = deq.pop();
                
                deq.push((ch == '+') ? o1 + o2 : (ch == '-') ? o1 - o2 : o1 * o2);
                
            } else {
                deq.push(Integer.parseInt(s[i]));
            } ch == '+' || ch == '-' || ch == '*' ch == '+' || ch == '-' || ch == '*' ch == '+' ch '+' ch == '-' ch '-' ch == '*' ch '*' {
                int o2 = deq.pop();
                int o1 = deq.pop();
                
                deq.push((ch == '+') ? o1 + o2 : (ch == '-') ? o1 - o2 : o1 * o2);
                
            } int o2 = deq.pop(); o2 deq.pop() deq.pop deq int o1 = deq.pop(); o1 deq.pop() deq.pop deq deq.push((ch == '+') ? o1 + o2 : (ch == '-') ? o1 - o2 : o1 * o2) deq.push deq (ch == '+') ? o1 + o2 : (ch == '-') ? o1 - o2 : o1 * o2 (ch == '+') ch '+' o1 + o2 o1 o2 (ch == '-') ? o1 - o2 : o1 * o2 (ch == '-') ch '-' o1 - o2 o1 o2 o1 * o2 o1 o2 {
                deq.push(Integer.parseInt(s[i]));
            } deq.push(Integer.parseInt(s[i])) deq.push deq Integer.parseInt(s[i]) Integer.parseInt Integer s[i] s i System.out.println(deq.pop()) System.out.println System.out System System.out deq.pop() deq.pop deq String[] args args public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String[] s = sc.nextLine().split(" ");
        Deque<Integer> deq = new ArrayDeque<Integer>();
        
        for (int i = 0; i < s.length; i++) {
            char ch = s[i].charAt(0);
            if (ch == '+' || ch == '-' || ch == '*') {
                int o2 = deq.pop();
                int o1 = deq.pop();
                
                deq.push((ch == '+') ? o1 + o2 : (ch == '-') ? o1 - o2 : o1 * o2);
                
            } else {
                deq.push(Integer.parseInt(s[i]));
            }
        }
        
        System.out.println(deq.pop());
    }
} public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String[] s = sc.nextLine().split(" ");
        Deque<Integer> deq = new ArrayDeque<Integer>();
        
        for (int i = 0; i < s.length; i++) {
            char ch = s[i].charAt(0);
            if (ch == '+' || ch == '-' || ch == '*') {
                int o2 = deq.pop();
                int o1 = deq.pop();
                
                deq.push((ch == '+') ? o1 + o2 : (ch == '-') ? o1 - o2 : o1 * o2);
                
            } else {
                deq.push(Integer.parseInt(s[i]));
            }
        }
        
        System.out.println(deq.pop());
    }
} Main
import java.util.ArrayDeque;
import java.util.Deque;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String[] s = sc.nextLine().split(" ");
        Deque<Integer> deq = new ArrayDeque<Integer>();
        
        for (int i = 0; i < s.length; i++) {
            char ch = s[i].charAt(0);
            if (ch == '+' || ch == '-' || ch == '*') {
                int o2 = deq.pop();
                int o1 = deq.pop();
                
                deq.push((ch == '+') ? o1 + o2 : (ch == '-') ? o1 - o2 : o1 * o2);
                
            } else {
                deq.push(Integer.parseInt(s[i]));
            }
        }
        
        System.out.println(deq.pop());
    }
}
