import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.ArrayDeque;
import java.util.Deque;

public class Main {

	public static void main(String[] args) throws Exception {
        // TODO ?????????????????????????????????????????????
       // System.out.println("0".compareTo("1"));
		Deque<Integer> stack = new ArrayDeque<Integer>();

        try (BufferedReader br = new BufferedReader(new InputStreamReader(System.in))) {
            String line=br.readLine();
            String[] str=line.split(" ");
            
            for(int i=0;i<str.length;i++){
            	if(str[i].equals("+")){
            		int a=stack.pop()+stack.pop();
            		stack.push(a);
            	}else if(str[i].equals("-")){
            		int aa=stack.pop();
            		int bb=stack.pop();
            		int a=bb-aa;
            		stack.push(a);
            	}else if(str[i].equals("*")){
            		int aa=stack.pop();
            		int bb=stack.pop();
            		int a=aa*bb;
            		stack.push(a);
            	}else{
            		stack.push(Integer.parseInt(str[i]));
            	}
            }
            System.out.println(stack.pop());
        }
	}

} import java.io.BufferedReader; BufferedReader java.io import java.io.InputStreamReader; InputStreamReader java.io import java.util.ArrayDeque; ArrayDeque java.util import java.util.Deque; Deque java.util public class Main {

	public static void main(String[] args) throws Exception {
        // TODO ?????????????????????????????????????????????
       // System.out.println("0".compareTo("1"));
		Deque<Integer> stack = new ArrayDeque<Integer>();

        try (BufferedReader br = new BufferedReader(new InputStreamReader(System.in))) {
            String line=br.readLine();
            String[] str=line.split(" ");
            
            for(int i=0;i<str.length;i++){
            	if(str[i].equals("+")){
            		int a=stack.pop()+stack.pop();
            		stack.push(a);
            	}else if(str[i].equals("-")){
            		int aa=stack.pop();
            		int bb=stack.pop();
            		int a=bb-aa;
            		stack.push(a);
            	}else if(str[i].equals("*")){
            		int aa=stack.pop();
            		int bb=stack.pop();
            		int a=aa*bb;
            		stack.push(a);
            	}else{
            		stack.push(Integer.parseInt(str[i]));
            	}
            }
            System.out.println(stack.pop());
        }
	}

} Main public static void main(String[] args) throws Exception {
        // TODO ?????????????????????????????????????????????
       // System.out.println("0".compareTo("1"));
		Deque<Integer> stack = new ArrayDeque<Integer>();

        try (BufferedReader br = new BufferedReader(new InputStreamReader(System.in))) {
            String line=br.readLine();
            String[] str=line.split(" ");
            
            for(int i=0;i<str.length;i++){
            	if(str[i].equals("+")){
            		int a=stack.pop()+stack.pop();
            		stack.push(a);
            	}else if(str[i].equals("-")){
            		int aa=stack.pop();
            		int bb=stack.pop();
            		int a=bb-aa;
            		stack.push(a);
            	}else if(str[i].equals("*")){
            		int aa=stack.pop();
            		int bb=stack.pop();
            		int a=aa*bb;
            		stack.push(a);
            	}else{
            		stack.push(Integer.parseInt(str[i]));
            	}
            }
            System.out.println(stack.pop());
        }
	} main {
        // TODO ?????????????????????????????????????????????
       // System.out.println("0".compareTo("1"));
		Deque<Integer> stack = new ArrayDeque<Integer>();

        try (BufferedReader br = new BufferedReader(new InputStreamReader(System.in))) {
            String line=br.readLine();
            String[] str=line.split(" ");
            
            for(int i=0;i<str.length;i++){
            	if(str[i].equals("+")){
            		int a=stack.pop()+stack.pop();
            		stack.push(a);
            	}else if(str[i].equals("-")){
            		int aa=stack.pop();
            		int bb=stack.pop();
            		int a=bb-aa;
            		stack.push(a);
            	}else if(str[i].equals("*")){
            		int aa=stack.pop();
            		int bb=stack.pop();
            		int a=aa*bb;
            		stack.push(a);
            	}else{
            		stack.push(Integer.parseInt(str[i]));
            	}
            }
            System.out.println(stack.pop());
        }
	} Deque<Integer> stack = new ArrayDeque<Integer>(); stack new ArrayDeque<Integer>() try (BufferedReader br = new BufferedReader(new InputStreamReader(System.in))) {
            String line=br.readLine();
            String[] str=line.split(" ");
            
            for(int i=0;i<str.length;i++){
            	if(str[i].equals("+")){
            		int a=stack.pop()+stack.pop();
            		stack.push(a);
            	}else if(str[i].equals("-")){
            		int aa=stack.pop();
            		int bb=stack.pop();
            		int a=bb-aa;
            		stack.push(a);
            	}else if(str[i].equals("*")){
            		int aa=stack.pop();
            		int bb=stack.pop();
            		int a=aa*bb;
            		stack.push(a);
            	}else{
            		stack.push(Integer.parseInt(str[i]));
            	}
            }
            System.out.println(stack.pop());
        } {
            String line=br.readLine();
            String[] str=line.split(" ");
            
            for(int i=0;i<str.length;i++){
            	if(str[i].equals("+")){
            		int a=stack.pop()+stack.pop();
            		stack.push(a);
            	}else if(str[i].equals("-")){
            		int aa=stack.pop();
            		int bb=stack.pop();
            		int a=bb-aa;
            		stack.push(a);
            	}else if(str[i].equals("*")){
            		int aa=stack.pop();
            		int bb=stack.pop();
            		int a=aa*bb;
            		stack.push(a);
            	}else{
            		stack.push(Integer.parseInt(str[i]));
            	}
            }
            System.out.println(stack.pop());
        } 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 String[] str=line.split(" "); str line.split(" ") line.split line " " for(int i=0;i<str.length;i++){
            	if(str[i].equals("+")){
            		int a=stack.pop()+stack.pop();
            		stack.push(a);
            	}else if(str[i].equals("-")){
            		int aa=stack.pop();
            		int bb=stack.pop();
            		int a=bb-aa;
            		stack.push(a);
            	}else if(str[i].equals("*")){
            		int aa=stack.pop();
            		int bb=stack.pop();
            		int a=aa*bb;
            		stack.push(a);
            	}else{
            		stack.push(Integer.parseInt(str[i]));
            	}
            } int i=0; int i=0; i 0 i<str.length i str.length str str.length i++ i++ i {
            	if(str[i].equals("+")){
            		int a=stack.pop()+stack.pop();
            		stack.push(a);
            	}else if(str[i].equals("-")){
            		int aa=stack.pop();
            		int bb=stack.pop();
            		int a=bb-aa;
            		stack.push(a);
            	}else if(str[i].equals("*")){
            		int aa=stack.pop();
            		int bb=stack.pop();
            		int a=aa*bb;
            		stack.push(a);
            	}else{
            		stack.push(Integer.parseInt(str[i]));
            	}
            } {
            	if(str[i].equals("+")){
            		int a=stack.pop()+stack.pop();
            		stack.push(a);
            	}else if(str[i].equals("-")){
            		int aa=stack.pop();
            		int bb=stack.pop();
            		int a=bb-aa;
            		stack.push(a);
            	}else if(str[i].equals("*")){
            		int aa=stack.pop();
            		int bb=stack.pop();
            		int a=aa*bb;
            		stack.push(a);
            	}else{
            		stack.push(Integer.parseInt(str[i]));
            	}
            } if(str[i].equals("+")){
            		int a=stack.pop()+stack.pop();
            		stack.push(a);
            	}else if(str[i].equals("-")){
            		int aa=stack.pop();
            		int bb=stack.pop();
            		int a=bb-aa;
            		stack.push(a);
            	}else if(str[i].equals("*")){
            		int aa=stack.pop();
            		int bb=stack.pop();
            		int a=aa*bb;
            		stack.push(a);
            	}else{
            		stack.push(Integer.parseInt(str[i]));
            	} str[i].equals("+") str[i].equals str[i] str i "+" {
            		int a=stack.pop()+stack.pop();
            		stack.push(a);
            	} int a=stack.pop()+stack.pop(); a stack.pop()+stack.pop() stack.pop() stack.pop stack stack.pop() stack.pop stack stack.push(a) stack.push stack a if(str[i].equals("-")){
            		int aa=stack.pop();
            		int bb=stack.pop();
            		int a=bb-aa;
            		stack.push(a);
            	}else if(str[i].equals("*")){
            		int aa=stack.pop();
            		int bb=stack.pop();
            		int a=aa*bb;
            		stack.push(a);
            	}else{
            		stack.push(Integer.parseInt(str[i]));
            	} str[i].equals("-") str[i].equals str[i] str i "-" {
            		int aa=stack.pop();
            		int bb=stack.pop();
            		int a=bb-aa;
            		stack.push(a);
            	} int aa=stack.pop(); aa stack.pop() stack.pop stack int bb=stack.pop(); bb stack.pop() stack.pop stack int a=bb-aa; a bb-aa bb aa stack.push(a) stack.push stack a if(str[i].equals("*")){
            		int aa=stack.pop();
            		int bb=stack.pop();
            		int a=aa*bb;
            		stack.push(a);
            	}else{
            		stack.push(Integer.parseInt(str[i]));
            	} str[i].equals("*") str[i].equals str[i] str i "*" {
            		int aa=stack.pop();
            		int bb=stack.pop();
            		int a=aa*bb;
            		stack.push(a);
            	} int aa=stack.pop(); aa stack.pop() stack.pop stack int bb=stack.pop(); bb stack.pop() stack.pop stack int a=aa*bb; a aa*bb aa bb stack.push(a) stack.push stack a {
            		stack.push(Integer.parseInt(str[i]));
            	} stack.push(Integer.parseInt(str[i])) stack.push stack Integer.parseInt(str[i]) Integer.parseInt Integer str[i] str i System.out.println(stack.pop()) System.out.println System.out System System.out stack.pop() stack.pop stack String[] args args public class Main {

	public static void main(String[] args) throws Exception {
        // TODO ?????????????????????????????????????????????
       // System.out.println("0".compareTo("1"));
		Deque<Integer> stack = new ArrayDeque<Integer>();

        try (BufferedReader br = new BufferedReader(new InputStreamReader(System.in))) {
            String line=br.readLine();
            String[] str=line.split(" ");
            
            for(int i=0;i<str.length;i++){
            	if(str[i].equals("+")){
            		int a=stack.pop()+stack.pop();
            		stack.push(a);
            	}else if(str[i].equals("-")){
            		int aa=stack.pop();
            		int bb=stack.pop();
            		int a=bb-aa;
            		stack.push(a);
            	}else if(str[i].equals("*")){
            		int aa=stack.pop();
            		int bb=stack.pop();
            		int a=aa*bb;
            		stack.push(a);
            	}else{
            		stack.push(Integer.parseInt(str[i]));
            	}
            }
            System.out.println(stack.pop());
        }
	}

} public class Main {

	public static void main(String[] args) throws Exception {
        // TODO ?????????????????????????????????????????????
       // System.out.println("0".compareTo("1"));
		Deque<Integer> stack = new ArrayDeque<Integer>();

        try (BufferedReader br = new BufferedReader(new InputStreamReader(System.in))) {
            String line=br.readLine();
            String[] str=line.split(" ");
            
            for(int i=0;i<str.length;i++){
            	if(str[i].equals("+")){
            		int a=stack.pop()+stack.pop();
            		stack.push(a);
            	}else if(str[i].equals("-")){
            		int aa=stack.pop();
            		int bb=stack.pop();
            		int a=bb-aa;
            		stack.push(a);
            	}else if(str[i].equals("*")){
            		int aa=stack.pop();
            		int bb=stack.pop();
            		int a=aa*bb;
            		stack.push(a);
            	}else{
            		stack.push(Integer.parseInt(str[i]));
            	}
            }
            System.out.println(stack.pop());
        }
	}

} Main
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.ArrayDeque;
import java.util.Deque;

public class Main {

	public static void main(String[] args) throws Exception {
        // TODO ?????????????????????????????????????????????
       // System.out.println("0".compareTo("1"));
		Deque<Integer> stack = new ArrayDeque<Integer>();

        try (BufferedReader br = new BufferedReader(new InputStreamReader(System.in))) {
            String line=br.readLine();
            String[] str=line.split(" ");
            
            for(int i=0;i<str.length;i++){
            	if(str[i].equals("+")){
            		int a=stack.pop()+stack.pop();
            		stack.push(a);
            	}else if(str[i].equals("-")){
            		int aa=stack.pop();
            		int bb=stack.pop();
            		int a=bb-aa;
            		stack.push(a);
            	}else if(str[i].equals("*")){
            		int aa=stack.pop();
            		int bb=stack.pop();
            		int a=aa*bb;
            		stack.push(a);
            	}else{
            		stack.push(Integer.parseInt(str[i]));
            	}
            }
            System.out.println(stack.pop());
        }
	}

}