import java.util.*;
public class Main{
	public static void main(String args[]){
		Stack<Integer> stack = new Stack<Integer>();
		Scanner sc = new Scanner(System.in);
		Set<String> ops = new HashSet<String>();
		ops.add("-");
		ops.add("+");
		ops.add("*");
		while(sc.hasNext()){
			String[] line = sc.nextLine().split(" ");
			for(int i=0;i<line.length;i++){
				String t =line[i];
				if(!ops.contains(t)){
					int val = Integer.parseInt(t);
					stack.push(val);
				}else{
					int val1 =stack.pop();
					int val2 = stack.pop();
					if(t.equals("+")){
						stack.push(val2+val1);
					}else if(t.equals("-")){
						stack.push(val2-val1);
					}else{
						stack.push(val2*val1);
					}
				}
			}
			System.out.println(stack.peek());
		}
	}

} import java.util.*; util.* java public class Main{
	public static void main(String args[]){
		Stack<Integer> stack = new Stack<Integer>();
		Scanner sc = new Scanner(System.in);
		Set<String> ops = new HashSet<String>();
		ops.add("-");
		ops.add("+");
		ops.add("*");
		while(sc.hasNext()){
			String[] line = sc.nextLine().split(" ");
			for(int i=0;i<line.length;i++){
				String t =line[i];
				if(!ops.contains(t)){
					int val = Integer.parseInt(t);
					stack.push(val);
				}else{
					int val1 =stack.pop();
					int val2 = stack.pop();
					if(t.equals("+")){
						stack.push(val2+val1);
					}else if(t.equals("-")){
						stack.push(val2-val1);
					}else{
						stack.push(val2*val1);
					}
				}
			}
			System.out.println(stack.peek());
		}
	}

} Main public static void main(String args[]){
		Stack<Integer> stack = new Stack<Integer>();
		Scanner sc = new Scanner(System.in);
		Set<String> ops = new HashSet<String>();
		ops.add("-");
		ops.add("+");
		ops.add("*");
		while(sc.hasNext()){
			String[] line = sc.nextLine().split(" ");
			for(int i=0;i<line.length;i++){
				String t =line[i];
				if(!ops.contains(t)){
					int val = Integer.parseInt(t);
					stack.push(val);
				}else{
					int val1 =stack.pop();
					int val2 = stack.pop();
					if(t.equals("+")){
						stack.push(val2+val1);
					}else if(t.equals("-")){
						stack.push(val2-val1);
					}else{
						stack.push(val2*val1);
					}
				}
			}
			System.out.println(stack.peek());
		}
	} main {
		Stack<Integer> stack = new Stack<Integer>();
		Scanner sc = new Scanner(System.in);
		Set<String> ops = new HashSet<String>();
		ops.add("-");
		ops.add("+");
		ops.add("*");
		while(sc.hasNext()){
			String[] line = sc.nextLine().split(" ");
			for(int i=0;i<line.length;i++){
				String t =line[i];
				if(!ops.contains(t)){
					int val = Integer.parseInt(t);
					stack.push(val);
				}else{
					int val1 =stack.pop();
					int val2 = stack.pop();
					if(t.equals("+")){
						stack.push(val2+val1);
					}else if(t.equals("-")){
						stack.push(val2-val1);
					}else{
						stack.push(val2*val1);
					}
				}
			}
			System.out.println(stack.peek());
		}
	} Stack<Integer> stack = new Stack<Integer>(); stack new Stack<Integer>() Scanner sc = new Scanner(System.in); sc new Scanner(System.in) Set<String> ops = new HashSet<String>(); ops new HashSet<String>() ops.add("-") ops.add ops "-" ops.add("+") ops.add ops "+" ops.add("*") ops.add ops "*" while(sc.hasNext()){
			String[] line = sc.nextLine().split(" ");
			for(int i=0;i<line.length;i++){
				String t =line[i];
				if(!ops.contains(t)){
					int val = Integer.parseInt(t);
					stack.push(val);
				}else{
					int val1 =stack.pop();
					int val2 = stack.pop();
					if(t.equals("+")){
						stack.push(val2+val1);
					}else if(t.equals("-")){
						stack.push(val2-val1);
					}else{
						stack.push(val2*val1);
					}
				}
			}
			System.out.println(stack.peek());
		} sc.hasNext() sc.hasNext sc {
			String[] line = sc.nextLine().split(" ");
			for(int i=0;i<line.length;i++){
				String t =line[i];
				if(!ops.contains(t)){
					int val = Integer.parseInt(t);
					stack.push(val);
				}else{
					int val1 =stack.pop();
					int val2 = stack.pop();
					if(t.equals("+")){
						stack.push(val2+val1);
					}else if(t.equals("-")){
						stack.push(val2-val1);
					}else{
						stack.push(val2*val1);
					}
				}
			}
			System.out.println(stack.peek());
		} String[] line = sc.nextLine().split(" "); line sc.nextLine().split(" ") sc.nextLine().split sc.nextLine() sc.nextLine sc " " for(int i=0;i<line.length;i++){
				String t =line[i];
				if(!ops.contains(t)){
					int val = Integer.parseInt(t);
					stack.push(val);
				}else{
					int val1 =stack.pop();
					int val2 = stack.pop();
					if(t.equals("+")){
						stack.push(val2+val1);
					}else if(t.equals("-")){
						stack.push(val2-val1);
					}else{
						stack.push(val2*val1);
					}
				}
			} int i=0; int i=0; i 0 i<line.length i line.length line line.length i++ i++ i {
				String t =line[i];
				if(!ops.contains(t)){
					int val = Integer.parseInt(t);
					stack.push(val);
				}else{
					int val1 =stack.pop();
					int val2 = stack.pop();
					if(t.equals("+")){
						stack.push(val2+val1);
					}else if(t.equals("-")){
						stack.push(val2-val1);
					}else{
						stack.push(val2*val1);
					}
				}
			} {
				String t =line[i];
				if(!ops.contains(t)){
					int val = Integer.parseInt(t);
					stack.push(val);
				}else{
					int val1 =stack.pop();
					int val2 = stack.pop();
					if(t.equals("+")){
						stack.push(val2+val1);
					}else if(t.equals("-")){
						stack.push(val2-val1);
					}else{
						stack.push(val2*val1);
					}
				}
			} String t =line[i]; t line[i] line i if(!ops.contains(t)){
					int val = Integer.parseInt(t);
					stack.push(val);
				}else{
					int val1 =stack.pop();
					int val2 = stack.pop();
					if(t.equals("+")){
						stack.push(val2+val1);
					}else if(t.equals("-")){
						stack.push(val2-val1);
					}else{
						stack.push(val2*val1);
					}
				} !ops.contains(t) ops.contains(t) ops.contains ops t {
					int val = Integer.parseInt(t);
					stack.push(val);
				} int val = Integer.parseInt(t); val Integer.parseInt(t) Integer.parseInt Integer t stack.push(val) stack.push stack val {
					int val1 =stack.pop();
					int val2 = stack.pop();
					if(t.equals("+")){
						stack.push(val2+val1);
					}else if(t.equals("-")){
						stack.push(val2-val1);
					}else{
						stack.push(val2*val1);
					}
				} int val1 =stack.pop(); val1 stack.pop() stack.pop stack int val2 = stack.pop(); val2 stack.pop() stack.pop stack if(t.equals("+")){
						stack.push(val2+val1);
					}else if(t.equals("-")){
						stack.push(val2-val1);
					}else{
						stack.push(val2*val1);
					} t.equals("+") t.equals t "+" {
						stack.push(val2+val1);
					} stack.push(val2+val1) stack.push stack val2+val1 val2 val1 if(t.equals("-")){
						stack.push(val2-val1);
					}else{
						stack.push(val2*val1);
					} t.equals("-") t.equals t "-" {
						stack.push(val2-val1);
					} stack.push(val2-val1) stack.push stack val2-val1 val2 val1 {
						stack.push(val2*val1);
					} stack.push(val2*val1) stack.push stack val2*val1 val2 val1 System.out.println(stack.peek()) System.out.println System.out System System.out stack.peek() stack.peek stack String args[] args public class Main{
	public static void main(String args[]){
		Stack<Integer> stack = new Stack<Integer>();
		Scanner sc = new Scanner(System.in);
		Set<String> ops = new HashSet<String>();
		ops.add("-");
		ops.add("+");
		ops.add("*");
		while(sc.hasNext()){
			String[] line = sc.nextLine().split(" ");
			for(int i=0;i<line.length;i++){
				String t =line[i];
				if(!ops.contains(t)){
					int val = Integer.parseInt(t);
					stack.push(val);
				}else{
					int val1 =stack.pop();
					int val2 = stack.pop();
					if(t.equals("+")){
						stack.push(val2+val1);
					}else if(t.equals("-")){
						stack.push(val2-val1);
					}else{
						stack.push(val2*val1);
					}
				}
			}
			System.out.println(stack.peek());
		}
	}

} public class Main{
	public static void main(String args[]){
		Stack<Integer> stack = new Stack<Integer>();
		Scanner sc = new Scanner(System.in);
		Set<String> ops = new HashSet<String>();
		ops.add("-");
		ops.add("+");
		ops.add("*");
		while(sc.hasNext()){
			String[] line = sc.nextLine().split(" ");
			for(int i=0;i<line.length;i++){
				String t =line[i];
				if(!ops.contains(t)){
					int val = Integer.parseInt(t);
					stack.push(val);
				}else{
					int val1 =stack.pop();
					int val2 = stack.pop();
					if(t.equals("+")){
						stack.push(val2+val1);
					}else if(t.equals("-")){
						stack.push(val2-val1);
					}else{
						stack.push(val2*val1);
					}
				}
			}
			System.out.println(stack.peek());
		}
	}

} Main
import java.util.*;
public class Main{
	public static void main(String args[]){
		Stack<Integer> stack = new Stack<Integer>();
		Scanner sc = new Scanner(System.in);
		Set<String> ops = new HashSet<String>();
		ops.add("-");
		ops.add("+");
		ops.add("*");
		while(sc.hasNext()){
			String[] line = sc.nextLine().split(" ");
			for(int i=0;i<line.length;i++){
				String t =line[i];
				if(!ops.contains(t)){
					int val = Integer.parseInt(t);
					stack.push(val);
				}else{
					int val1 =stack.pop();
					int val2 = stack.pop();
					if(t.equals("+")){
						stack.push(val2+val1);
					}else if(t.equals("-")){
						stack.push(val2-val1);
					}else{
						stack.push(val2*val1);
					}
				}
			}
			System.out.println(stack.peek());
		}
	}

}