import java.util.*;

public class Main{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
			while(sc.hasNext()){
				String str = sc.nextLine();
				String[] s = str.split(" ");
				Stack<Integer> stk = new Stack<Integer>();
				if(s.length > 2){
					for(int i=0;i<s.length;i++){
						if(s[i].toString().equals("*"))
							stk.push((stk.pop()*stk.pop()));
						else if(s[i].toString().equals("/")){
							int a=stk.pop(),b=stk.pop();
							stk.push(b/a);
						}
						else if(s[i].toString().equals("+"))
							stk.push((stk.pop()+stk.pop()));
						else if(s[i].toString().equals("-")){
							int a=stk.pop(),b=stk.pop();
							stk.push(b-a);
						}
						else{
							stk.push(Integer.valueOf(s[i].toString()));
						}
					}
					System.out.printf("%d\r\n",stk.pop());
				}
			}
	}
} import java.util.*; util.* java public class Main{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
			while(sc.hasNext()){
				String str = sc.nextLine();
				String[] s = str.split(" ");
				Stack<Integer> stk = new Stack<Integer>();
				if(s.length > 2){
					for(int i=0;i<s.length;i++){
						if(s[i].toString().equals("*"))
							stk.push((stk.pop()*stk.pop()));
						else if(s[i].toString().equals("/")){
							int a=stk.pop(),b=stk.pop();
							stk.push(b/a);
						}
						else if(s[i].toString().equals("+"))
							stk.push((stk.pop()+stk.pop()));
						else if(s[i].toString().equals("-")){
							int a=stk.pop(),b=stk.pop();
							stk.push(b-a);
						}
						else{
							stk.push(Integer.valueOf(s[i].toString()));
						}
					}
					System.out.printf("%d\r\n",stk.pop());
				}
			}
	}
} Main public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
			while(sc.hasNext()){
				String str = sc.nextLine();
				String[] s = str.split(" ");
				Stack<Integer> stk = new Stack<Integer>();
				if(s.length > 2){
					for(int i=0;i<s.length;i++){
						if(s[i].toString().equals("*"))
							stk.push((stk.pop()*stk.pop()));
						else if(s[i].toString().equals("/")){
							int a=stk.pop(),b=stk.pop();
							stk.push(b/a);
						}
						else if(s[i].toString().equals("+"))
							stk.push((stk.pop()+stk.pop()));
						else if(s[i].toString().equals("-")){
							int a=stk.pop(),b=stk.pop();
							stk.push(b-a);
						}
						else{
							stk.push(Integer.valueOf(s[i].toString()));
						}
					}
					System.out.printf("%d\r\n",stk.pop());
				}
			}
	} main {
		Scanner sc = new Scanner(System.in);
			while(sc.hasNext()){
				String str = sc.nextLine();
				String[] s = str.split(" ");
				Stack<Integer> stk = new Stack<Integer>();
				if(s.length > 2){
					for(int i=0;i<s.length;i++){
						if(s[i].toString().equals("*"))
							stk.push((stk.pop()*stk.pop()));
						else if(s[i].toString().equals("/")){
							int a=stk.pop(),b=stk.pop();
							stk.push(b/a);
						}
						else if(s[i].toString().equals("+"))
							stk.push((stk.pop()+stk.pop()));
						else if(s[i].toString().equals("-")){
							int a=stk.pop(),b=stk.pop();
							stk.push(b-a);
						}
						else{
							stk.push(Integer.valueOf(s[i].toString()));
						}
					}
					System.out.printf("%d\r\n",stk.pop());
				}
			}
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) while(sc.hasNext()){
				String str = sc.nextLine();
				String[] s = str.split(" ");
				Stack<Integer> stk = new Stack<Integer>();
				if(s.length > 2){
					for(int i=0;i<s.length;i++){
						if(s[i].toString().equals("*"))
							stk.push((stk.pop()*stk.pop()));
						else if(s[i].toString().equals("/")){
							int a=stk.pop(),b=stk.pop();
							stk.push(b/a);
						}
						else if(s[i].toString().equals("+"))
							stk.push((stk.pop()+stk.pop()));
						else if(s[i].toString().equals("-")){
							int a=stk.pop(),b=stk.pop();
							stk.push(b-a);
						}
						else{
							stk.push(Integer.valueOf(s[i].toString()));
						}
					}
					System.out.printf("%d\r\n",stk.pop());
				}
			} sc.hasNext() sc.hasNext sc {
				String str = sc.nextLine();
				String[] s = str.split(" ");
				Stack<Integer> stk = new Stack<Integer>();
				if(s.length > 2){
					for(int i=0;i<s.length;i++){
						if(s[i].toString().equals("*"))
							stk.push((stk.pop()*stk.pop()));
						else if(s[i].toString().equals("/")){
							int a=stk.pop(),b=stk.pop();
							stk.push(b/a);
						}
						else if(s[i].toString().equals("+"))
							stk.push((stk.pop()+stk.pop()));
						else if(s[i].toString().equals("-")){
							int a=stk.pop(),b=stk.pop();
							stk.push(b-a);
						}
						else{
							stk.push(Integer.valueOf(s[i].toString()));
						}
					}
					System.out.printf("%d\r\n",stk.pop());
				}
			} String str = sc.nextLine(); str sc.nextLine() sc.nextLine sc String[] s = str.split(" "); s str.split(" ") str.split str " " Stack<Integer> stk = new Stack<Integer>(); stk new Stack<Integer>() if(s.length > 2){
					for(int i=0;i<s.length;i++){
						if(s[i].toString().equals("*"))
							stk.push((stk.pop()*stk.pop()));
						else if(s[i].toString().equals("/")){
							int a=stk.pop(),b=stk.pop();
							stk.push(b/a);
						}
						else if(s[i].toString().equals("+"))
							stk.push((stk.pop()+stk.pop()));
						else if(s[i].toString().equals("-")){
							int a=stk.pop(),b=stk.pop();
							stk.push(b-a);
						}
						else{
							stk.push(Integer.valueOf(s[i].toString()));
						}
					}
					System.out.printf("%d\r\n",stk.pop());
				} s.length > 2 s.length s s.length 2 {
					for(int i=0;i<s.length;i++){
						if(s[i].toString().equals("*"))
							stk.push((stk.pop()*stk.pop()));
						else if(s[i].toString().equals("/")){
							int a=stk.pop(),b=stk.pop();
							stk.push(b/a);
						}
						else if(s[i].toString().equals("+"))
							stk.push((stk.pop()+stk.pop()));
						else if(s[i].toString().equals("-")){
							int a=stk.pop(),b=stk.pop();
							stk.push(b-a);
						}
						else{
							stk.push(Integer.valueOf(s[i].toString()));
						}
					}
					System.out.printf("%d\r\n",stk.pop());
				} for(int i=0;i<s.length;i++){
						if(s[i].toString().equals("*"))
							stk.push((stk.pop()*stk.pop()));
						else if(s[i].toString().equals("/")){
							int a=stk.pop(),b=stk.pop();
							stk.push(b/a);
						}
						else if(s[i].toString().equals("+"))
							stk.push((stk.pop()+stk.pop()));
						else if(s[i].toString().equals("-")){
							int a=stk.pop(),b=stk.pop();
							stk.push(b-a);
						}
						else{
							stk.push(Integer.valueOf(s[i].toString()));
						}
					} int i=0; int i=0; i 0 i<s.length i s.length s s.length i++ i++ i {
						if(s[i].toString().equals("*"))
							stk.push((stk.pop()*stk.pop()));
						else if(s[i].toString().equals("/")){
							int a=stk.pop(),b=stk.pop();
							stk.push(b/a);
						}
						else if(s[i].toString().equals("+"))
							stk.push((stk.pop()+stk.pop()));
						else if(s[i].toString().equals("-")){
							int a=stk.pop(),b=stk.pop();
							stk.push(b-a);
						}
						else{
							stk.push(Integer.valueOf(s[i].toString()));
						}
					} {
						if(s[i].toString().equals("*"))
							stk.push((stk.pop()*stk.pop()));
						else if(s[i].toString().equals("/")){
							int a=stk.pop(),b=stk.pop();
							stk.push(b/a);
						}
						else if(s[i].toString().equals("+"))
							stk.push((stk.pop()+stk.pop()));
						else if(s[i].toString().equals("-")){
							int a=stk.pop(),b=stk.pop();
							stk.push(b-a);
						}
						else{
							stk.push(Integer.valueOf(s[i].toString()));
						}
					} if(s[i].toString().equals("*"))
							stk.push((stk.pop()*stk.pop()));
						else if(s[i].toString().equals("/")){
							int a=stk.pop(),b=stk.pop();
							stk.push(b/a);
						}
						else if(s[i].toString().equals("+"))
							stk.push((stk.pop()+stk.pop()));
						else if(s[i].toString().equals("-")){
							int a=stk.pop(),b=stk.pop();
							stk.push(b-a);
						}
						else{
							stk.push(Integer.valueOf(s[i].toString()));
						} s[i].toString().equals("*") s[i].toString().equals s[i].toString() s[i].toString s[i] s i "*" stk.push((stk.pop()*stk.pop())) stk.push stk (stk.pop()*stk.pop()) stk.pop() stk.pop stk stk.pop() stk.pop stk if(s[i].toString().equals("/")){
							int a=stk.pop(),b=stk.pop();
							stk.push(b/a);
						}
						else if(s[i].toString().equals("+"))
							stk.push((stk.pop()+stk.pop()));
						else if(s[i].toString().equals("-")){
							int a=stk.pop(),b=stk.pop();
							stk.push(b-a);
						}
						else{
							stk.push(Integer.valueOf(s[i].toString()));
						} s[i].toString().equals("/") s[i].toString().equals s[i].toString() s[i].toString s[i] s i "/" {
							int a=stk.pop(),b=stk.pop();
							stk.push(b/a);
						} int a=stk.pop() a stk.pop() stk.pop stk b=stk.pop(); b stk.pop() stk.pop stk stk.push(b/a) stk.push stk b/a b a if(s[i].toString().equals("+"))
							stk.push((stk.pop()+stk.pop()));
						else if(s[i].toString().equals("-")){
							int a=stk.pop(),b=stk.pop();
							stk.push(b-a);
						}
						else{
							stk.push(Integer.valueOf(s[i].toString()));
						} s[i].toString().equals("+") s[i].toString().equals s[i].toString() s[i].toString s[i] s i "+" stk.push((stk.pop()+stk.pop())) stk.push stk (stk.pop()+stk.pop()) stk.pop() stk.pop stk stk.pop() stk.pop stk if(s[i].toString().equals("-")){
							int a=stk.pop(),b=stk.pop();
							stk.push(b-a);
						}
						else{
							stk.push(Integer.valueOf(s[i].toString()));
						} s[i].toString().equals("-") s[i].toString().equals s[i].toString() s[i].toString s[i] s i "-" {
							int a=stk.pop(),b=stk.pop();
							stk.push(b-a);
						} int a=stk.pop() a stk.pop() stk.pop stk b=stk.pop(); b stk.pop() stk.pop stk stk.push(b-a) stk.push stk b-a b a {
							stk.push(Integer.valueOf(s[i].toString()));
						} stk.push(Integer.valueOf(s[i].toString())) stk.push stk Integer.valueOf(s[i].toString()) Integer.valueOf Integer s[i].toString() s[i].toString s[i] s i System.out.printf("%d\r\n",stk.pop()) System.out.printf System.out System System.out "%d\r\n" stk.pop() stk.pop stk String[] args args public class Main{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
			while(sc.hasNext()){
				String str = sc.nextLine();
				String[] s = str.split(" ");
				Stack<Integer> stk = new Stack<Integer>();
				if(s.length > 2){
					for(int i=0;i<s.length;i++){
						if(s[i].toString().equals("*"))
							stk.push((stk.pop()*stk.pop()));
						else if(s[i].toString().equals("/")){
							int a=stk.pop(),b=stk.pop();
							stk.push(b/a);
						}
						else if(s[i].toString().equals("+"))
							stk.push((stk.pop()+stk.pop()));
						else if(s[i].toString().equals("-")){
							int a=stk.pop(),b=stk.pop();
							stk.push(b-a);
						}
						else{
							stk.push(Integer.valueOf(s[i].toString()));
						}
					}
					System.out.printf("%d\r\n",stk.pop());
				}
			}
	}
} public class Main{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
			while(sc.hasNext()){
				String str = sc.nextLine();
				String[] s = str.split(" ");
				Stack<Integer> stk = new Stack<Integer>();
				if(s.length > 2){
					for(int i=0;i<s.length;i++){
						if(s[i].toString().equals("*"))
							stk.push((stk.pop()*stk.pop()));
						else if(s[i].toString().equals("/")){
							int a=stk.pop(),b=stk.pop();
							stk.push(b/a);
						}
						else if(s[i].toString().equals("+"))
							stk.push((stk.pop()+stk.pop()));
						else if(s[i].toString().equals("-")){
							int a=stk.pop(),b=stk.pop();
							stk.push(b-a);
						}
						else{
							stk.push(Integer.valueOf(s[i].toString()));
						}
					}
					System.out.printf("%d\r\n",stk.pop());
				}
			}
	}
} Main
import java.util.*;

public class Main{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
			while(sc.hasNext()){
				String str = sc.nextLine();
				String[] s = str.split(" ");
				Stack<Integer> stk = new Stack<Integer>();
				if(s.length > 2){
					for(int i=0;i<s.length;i++){
						if(s[i].toString().equals("*"))
							stk.push((stk.pop()*stk.pop()));
						else if(s[i].toString().equals("/")){
							int a=stk.pop(),b=stk.pop();
							stk.push(b/a);
						}
						else if(s[i].toString().equals("+"))
							stk.push((stk.pop()+stk.pop()));
						else if(s[i].toString().equals("-")){
							int a=stk.pop(),b=stk.pop();
							stk.push(b-a);
						}
						else{
							stk.push(Integer.valueOf(s[i].toString()));
						}
					}
					System.out.printf("%d\r\n",stk.pop());
				}
			}
	}
}
