import java.util.*;

public class Main{
	private static final Scanner scan = new Scanner(System.in);
	private static final int MAX = 101;
	private static int[] st = new int[MAX];
	private static int top;

	public static void main(String[] args){

		initialize();
		while(scan.hasNext()){
			String[] cmd = scan.nextLine().split(" ");
			for(int i = 0; i < cmd.length; i++){
				if(cmd[i].equals("+")){
					int n2 = pop();
					int n3 = pop();
					n2 = n3 + n2;
					push(n2);
				}else if(cmd[i].equals("-")){
					int n2 = pop();
					int n3 = pop();
					n2 = n3 - n2;
					push(n2);
				}else if(cmd[i].equals("*")){
					int n2 = pop();
					int n3 = pop();
					n2 = n3 * n2;
					push(n2);
				}else{
					int n = Integer.parseInt(cmd[i]);
					push(n);
				}
			}
			System.out.printf("%d\n", st[1]);
		}
	}

	public static void initialize(){
		top = 0;
	}
	private static boolean isEmpty(){
		return top == 0;
	}
	private static boolean isFull(){
		return top >= MAX - 1;
	}
	public static void push(int x){
		if(isFull())
			System.out.printf("%s\n", "???????????????????????§???");
		top++;
		st[top] = x;
	}
	public static int pop(){
		if(isEmpty())
			System.out.printf("%s\n", "??¢????????????????????§???");
		top--;
		return st[top+1];
	}
} import java.util.*; util.* java public class Main{
	private static final Scanner scan = new Scanner(System.in);
	private static final int MAX = 101;
	private static int[] st = new int[MAX];
	private static int top;

	public static void main(String[] args){

		initialize();
		while(scan.hasNext()){
			String[] cmd = scan.nextLine().split(" ");
			for(int i = 0; i < cmd.length; i++){
				if(cmd[i].equals("+")){
					int n2 = pop();
					int n3 = pop();
					n2 = n3 + n2;
					push(n2);
				}else if(cmd[i].equals("-")){
					int n2 = pop();
					int n3 = pop();
					n2 = n3 - n2;
					push(n2);
				}else if(cmd[i].equals("*")){
					int n2 = pop();
					int n3 = pop();
					n2 = n3 * n2;
					push(n2);
				}else{
					int n = Integer.parseInt(cmd[i]);
					push(n);
				}
			}
			System.out.printf("%d\n", st[1]);
		}
	}

	public static void initialize(){
		top = 0;
	}
	private static boolean isEmpty(){
		return top == 0;
	}
	private static boolean isFull(){
		return top >= MAX - 1;
	}
	public static void push(int x){
		if(isFull())
			System.out.printf("%s\n", "???????????????????????§???");
		top++;
		st[top] = x;
	}
	public static int pop(){
		if(isEmpty())
			System.out.printf("%s\n", "??¢????????????????????§???");
		top--;
		return st[top+1];
	}
} Main private static final Scanner scan = new Scanner(System.in); scan new Scanner(System.in) private static final int MAX = 101; MAX 101 private static int[] st = new int[MAX]; st new int[MAX] MAX private static int top; top public static void main(String[] args){

		initialize();
		while(scan.hasNext()){
			String[] cmd = scan.nextLine().split(" ");
			for(int i = 0; i < cmd.length; i++){
				if(cmd[i].equals("+")){
					int n2 = pop();
					int n3 = pop();
					n2 = n3 + n2;
					push(n2);
				}else if(cmd[i].equals("-")){
					int n2 = pop();
					int n3 = pop();
					n2 = n3 - n2;
					push(n2);
				}else if(cmd[i].equals("*")){
					int n2 = pop();
					int n3 = pop();
					n2 = n3 * n2;
					push(n2);
				}else{
					int n = Integer.parseInt(cmd[i]);
					push(n);
				}
			}
			System.out.printf("%d\n", st[1]);
		}
	} main {

		initialize();
		while(scan.hasNext()){
			String[] cmd = scan.nextLine().split(" ");
			for(int i = 0; i < cmd.length; i++){
				if(cmd[i].equals("+")){
					int n2 = pop();
					int n3 = pop();
					n2 = n3 + n2;
					push(n2);
				}else if(cmd[i].equals("-")){
					int n2 = pop();
					int n3 = pop();
					n2 = n3 - n2;
					push(n2);
				}else if(cmd[i].equals("*")){
					int n2 = pop();
					int n3 = pop();
					n2 = n3 * n2;
					push(n2);
				}else{
					int n = Integer.parseInt(cmd[i]);
					push(n);
				}
			}
			System.out.printf("%d\n", st[1]);
		}
	} initialize() initialize while(scan.hasNext()){
			String[] cmd = scan.nextLine().split(" ");
			for(int i = 0; i < cmd.length; i++){
				if(cmd[i].equals("+")){
					int n2 = pop();
					int n3 = pop();
					n2 = n3 + n2;
					push(n2);
				}else if(cmd[i].equals("-")){
					int n2 = pop();
					int n3 = pop();
					n2 = n3 - n2;
					push(n2);
				}else if(cmd[i].equals("*")){
					int n2 = pop();
					int n3 = pop();
					n2 = n3 * n2;
					push(n2);
				}else{
					int n = Integer.parseInt(cmd[i]);
					push(n);
				}
			}
			System.out.printf("%d\n", st[1]);
		} scan.hasNext() scan.hasNext scan {
			String[] cmd = scan.nextLine().split(" ");
			for(int i = 0; i < cmd.length; i++){
				if(cmd[i].equals("+")){
					int n2 = pop();
					int n3 = pop();
					n2 = n3 + n2;
					push(n2);
				}else if(cmd[i].equals("-")){
					int n2 = pop();
					int n3 = pop();
					n2 = n3 - n2;
					push(n2);
				}else if(cmd[i].equals("*")){
					int n2 = pop();
					int n3 = pop();
					n2 = n3 * n2;
					push(n2);
				}else{
					int n = Integer.parseInt(cmd[i]);
					push(n);
				}
			}
			System.out.printf("%d\n", st[1]);
		} String[] cmd = scan.nextLine().split(" "); cmd scan.nextLine().split(" ") scan.nextLine().split scan.nextLine() scan.nextLine scan " " for(int i = 0; i < cmd.length; i++){
				if(cmd[i].equals("+")){
					int n2 = pop();
					int n3 = pop();
					n2 = n3 + n2;
					push(n2);
				}else if(cmd[i].equals("-")){
					int n2 = pop();
					int n3 = pop();
					n2 = n3 - n2;
					push(n2);
				}else if(cmd[i].equals("*")){
					int n2 = pop();
					int n3 = pop();
					n2 = n3 * n2;
					push(n2);
				}else{
					int n = Integer.parseInt(cmd[i]);
					push(n);
				}
			} int i = 0; int i = 0; i 0 i < cmd.length i cmd.length cmd cmd.length i++ i++ i {
				if(cmd[i].equals("+")){
					int n2 = pop();
					int n3 = pop();
					n2 = n3 + n2;
					push(n2);
				}else if(cmd[i].equals("-")){
					int n2 = pop();
					int n3 = pop();
					n2 = n3 - n2;
					push(n2);
				}else if(cmd[i].equals("*")){
					int n2 = pop();
					int n3 = pop();
					n2 = n3 * n2;
					push(n2);
				}else{
					int n = Integer.parseInt(cmd[i]);
					push(n);
				}
			} {
				if(cmd[i].equals("+")){
					int n2 = pop();
					int n3 = pop();
					n2 = n3 + n2;
					push(n2);
				}else if(cmd[i].equals("-")){
					int n2 = pop();
					int n3 = pop();
					n2 = n3 - n2;
					push(n2);
				}else if(cmd[i].equals("*")){
					int n2 = pop();
					int n3 = pop();
					n2 = n3 * n2;
					push(n2);
				}else{
					int n = Integer.parseInt(cmd[i]);
					push(n);
				}
			} if(cmd[i].equals("+")){
					int n2 = pop();
					int n3 = pop();
					n2 = n3 + n2;
					push(n2);
				}else if(cmd[i].equals("-")){
					int n2 = pop();
					int n3 = pop();
					n2 = n3 - n2;
					push(n2);
				}else if(cmd[i].equals("*")){
					int n2 = pop();
					int n3 = pop();
					n2 = n3 * n2;
					push(n2);
				}else{
					int n = Integer.parseInt(cmd[i]);
					push(n);
				} cmd[i].equals("+") cmd[i].equals cmd[i] cmd i "+" {
					int n2 = pop();
					int n3 = pop();
					n2 = n3 + n2;
					push(n2);
				} int n2 = pop(); n2 pop() pop int n3 = pop(); n3 pop() pop n2 = n3 + n2 n2 n3 + n2 n3 n2 push(n2) push n2 if(cmd[i].equals("-")){
					int n2 = pop();
					int n3 = pop();
					n2 = n3 - n2;
					push(n2);
				}else if(cmd[i].equals("*")){
					int n2 = pop();
					int n3 = pop();
					n2 = n3 * n2;
					push(n2);
				}else{
					int n = Integer.parseInt(cmd[i]);
					push(n);
				} cmd[i].equals("-") cmd[i].equals cmd[i] cmd i "-" {
					int n2 = pop();
					int n3 = pop();
					n2 = n3 - n2;
					push(n2);
				} int n2 = pop(); n2 pop() pop int n3 = pop(); n3 pop() pop n2 = n3 - n2 n2 n3 - n2 n3 n2 push(n2) push n2 if(cmd[i].equals("*")){
					int n2 = pop();
					int n3 = pop();
					n2 = n3 * n2;
					push(n2);
				}else{
					int n = Integer.parseInt(cmd[i]);
					push(n);
				} cmd[i].equals("*") cmd[i].equals cmd[i] cmd i "*" {
					int n2 = pop();
					int n3 = pop();
					n2 = n3 * n2;
					push(n2);
				} int n2 = pop(); n2 pop() pop int n3 = pop(); n3 pop() pop n2 = n3 * n2 n2 n3 * n2 n3 n2 push(n2) push n2 {
					int n = Integer.parseInt(cmd[i]);
					push(n);
				} int n = Integer.parseInt(cmd[i]); n Integer.parseInt(cmd[i]) Integer.parseInt Integer cmd[i] cmd i push(n) push n System.out.printf("%d\n", st[1]) System.out.printf System.out System System.out "%d\n" st[1] st 1 String[] args args public static void initialize(){
		top = 0;
	} initialize {
		top = 0;
	} top = 0 top 0 private static boolean isEmpty(){
		return top == 0;
	} isEmpty {
		return top == 0;
	} return top == 0; top == 0 top 0 private static boolean isFull(){
		return top >= MAX - 1;
	} isFull {
		return top >= MAX - 1;
	} return top >= MAX - 1; top >= MAX - 1 top MAX - 1 MAX 1 public static void push(int x){
		if(isFull())
			System.out.printf("%s\n", "???????????????????????§???");
		top++;
		st[top] = x;
	} push {
		if(isFull())
			System.out.printf("%s\n", "???????????????????????§???");
		top++;
		st[top] = x;
	} if(isFull())
			System.out.printf("%s\n", "???????????????????????§???"); isFull() isFull System.out.printf("%s\n", "???????????????????????§???") System.out.printf System.out System System.out "%s\n" "???????????????????????§???" top++ top st[top] = x st[top] st top x int x x public static int pop(){
		if(isEmpty())
			System.out.printf("%s\n", "??¢????????????????????§???");
		top--;
		return st[top+1];
	} pop {
		if(isEmpty())
			System.out.printf("%s\n", "??¢????????????????????§???");
		top--;
		return st[top+1];
	} if(isEmpty())
			System.out.printf("%s\n", "??¢????????????????????§???"); isEmpty() isEmpty System.out.printf("%s\n", "??¢????????????????????§???") System.out.printf System.out System System.out "%s\n" "??¢????????????????????§???" top-- top return st[top+1]; st[top+1] st top+1 top 1 public class Main{
	private static final Scanner scan = new Scanner(System.in);
	private static final int MAX = 101;
	private static int[] st = new int[MAX];
	private static int top;

	public static void main(String[] args){

		initialize();
		while(scan.hasNext()){
			String[] cmd = scan.nextLine().split(" ");
			for(int i = 0; i < cmd.length; i++){
				if(cmd[i].equals("+")){
					int n2 = pop();
					int n3 = pop();
					n2 = n3 + n2;
					push(n2);
				}else if(cmd[i].equals("-")){
					int n2 = pop();
					int n3 = pop();
					n2 = n3 - n2;
					push(n2);
				}else if(cmd[i].equals("*")){
					int n2 = pop();
					int n3 = pop();
					n2 = n3 * n2;
					push(n2);
				}else{
					int n = Integer.parseInt(cmd[i]);
					push(n);
				}
			}
			System.out.printf("%d\n", st[1]);
		}
	}

	public static void initialize(){
		top = 0;
	}
	private static boolean isEmpty(){
		return top == 0;
	}
	private static boolean isFull(){
		return top >= MAX - 1;
	}
	public static void push(int x){
		if(isFull())
			System.out.printf("%s\n", "???????????????????????§???");
		top++;
		st[top] = x;
	}
	public static int pop(){
		if(isEmpty())
			System.out.printf("%s\n", "??¢????????????????????§???");
		top--;
		return st[top+1];
	}
} public class Main{
	private static final Scanner scan = new Scanner(System.in);
	private static final int MAX = 101;
	private static int[] st = new int[MAX];
	private static int top;

	public static void main(String[] args){

		initialize();
		while(scan.hasNext()){
			String[] cmd = scan.nextLine().split(" ");
			for(int i = 0; i < cmd.length; i++){
				if(cmd[i].equals("+")){
					int n2 = pop();
					int n3 = pop();
					n2 = n3 + n2;
					push(n2);
				}else if(cmd[i].equals("-")){
					int n2 = pop();
					int n3 = pop();
					n2 = n3 - n2;
					push(n2);
				}else if(cmd[i].equals("*")){
					int n2 = pop();
					int n3 = pop();
					n2 = n3 * n2;
					push(n2);
				}else{
					int n = Integer.parseInt(cmd[i]);
					push(n);
				}
			}
			System.out.printf("%d\n", st[1]);
		}
	}

	public static void initialize(){
		top = 0;
	}
	private static boolean isEmpty(){
		return top == 0;
	}
	private static boolean isFull(){
		return top >= MAX - 1;
	}
	public static void push(int x){
		if(isFull())
			System.out.printf("%s\n", "???????????????????????§???");
		top++;
		st[top] = x;
	}
	public static int pop(){
		if(isEmpty())
			System.out.printf("%s\n", "??¢????????????????????§???");
		top--;
		return st[top+1];
	}
} Main
import java.util.*;

public class Main{
	private static final Scanner scan = new Scanner(System.in);
	private static final int MAX = 101;
	private static int[] st = new int[MAX];
	private static int top;

	public static void main(String[] args){

		initialize();
		while(scan.hasNext()){
			String[] cmd = scan.nextLine().split(" ");
			for(int i = 0; i < cmd.length; i++){
				if(cmd[i].equals("+")){
					int n2 = pop();
					int n3 = pop();
					n2 = n3 + n2;
					push(n2);
				}else if(cmd[i].equals("-")){
					int n2 = pop();
					int n3 = pop();
					n2 = n3 - n2;
					push(n2);
				}else if(cmd[i].equals("*")){
					int n2 = pop();
					int n3 = pop();
					n2 = n3 * n2;
					push(n2);
				}else{
					int n = Integer.parseInt(cmd[i]);
					push(n);
				}
			}
			System.out.printf("%d\n", st[1]);
		}
	}

	public static void initialize(){
		top = 0;
	}
	private static boolean isEmpty(){
		return top == 0;
	}
	private static boolean isFull(){
		return top >= MAX - 1;
	}
	public static void push(int x){
		if(isFull())
			System.out.printf("%s\n", "???????????????????????§???");
		top++;
		st[top] = x;
	}
	public static int pop(){
		if(isEmpty())
			System.out.printf("%s\n", "??¢????????????????????§???");
		top--;
		return st[top+1];
	}
}