import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main{




	public static void main(String[] args){

		int len;
		String array[];

		BufferedReader reader=new BufferedReader(new InputStreamReader(System.in));

		try{
		String str=reader.readLine();
		array=str.split(" ");

		len=array.length;

		Stack stack=new Stack(len);
		int tmp;

		for(int i=0;i<len;i++){
			switch(array[i]){
			case"+":
				tmp=stack.pop()+stack.pop();
				stack.push(tmp);
				break;
			case"-":
				tmp=stack.pop()-stack.pop();
				stack.push(-tmp);
				break;
			case"*":
				tmp=stack.pop()*stack.pop();
				stack.push(tmp);
				break;
			default:
				tmp=Integer.parseInt(array[i]);
				stack.push(tmp);
			}//swicth

		}//for

		System.out.println(stack.pop());



		}catch(IOException e){

		}

	}//main
}

class Stack{
	int max;
	int ptr;
	int[] array;

	Stack(int capacity){//?????????????????????
		max=capacity;
		ptr=0;
		array=new int[max];
	}

	public void push(int p){
		if(ptr<=max)array[ptr++]=p;
	}//push????????????

	public int pop(){
		if(ptr>0)return array[--ptr];
		else return -1;
	}//pop????????????

}//stack????????? import java.io.BufferedReader; BufferedReader java.io import java.io.IOException; IOException java.io import java.io.InputStreamReader; InputStreamReader java.io public class Main{




	public static void main(String[] args){

		int len;
		String array[];

		BufferedReader reader=new BufferedReader(new InputStreamReader(System.in));

		try{
		String str=reader.readLine();
		array=str.split(" ");

		len=array.length;

		Stack stack=new Stack(len);
		int tmp;

		for(int i=0;i<len;i++){
			switch(array[i]){
			case"+":
				tmp=stack.pop()+stack.pop();
				stack.push(tmp);
				break;
			case"-":
				tmp=stack.pop()-stack.pop();
				stack.push(-tmp);
				break;
			case"*":
				tmp=stack.pop()*stack.pop();
				stack.push(tmp);
				break;
			default:
				tmp=Integer.parseInt(array[i]);
				stack.push(tmp);
			}//swicth

		}//for

		System.out.println(stack.pop());



		}catch(IOException e){

		}

	}//main
} Main public static void main(String[] args){

		int len;
		String array[];

		BufferedReader reader=new BufferedReader(new InputStreamReader(System.in));

		try{
		String str=reader.readLine();
		array=str.split(" ");

		len=array.length;

		Stack stack=new Stack(len);
		int tmp;

		for(int i=0;i<len;i++){
			switch(array[i]){
			case"+":
				tmp=stack.pop()+stack.pop();
				stack.push(tmp);
				break;
			case"-":
				tmp=stack.pop()-stack.pop();
				stack.push(-tmp);
				break;
			case"*":
				tmp=stack.pop()*stack.pop();
				stack.push(tmp);
				break;
			default:
				tmp=Integer.parseInt(array[i]);
				stack.push(tmp);
			}//swicth

		}//for

		System.out.println(stack.pop());



		}catch(IOException e){

		}

	}//main main {

		int len;
		String array[];

		BufferedReader reader=new BufferedReader(new InputStreamReader(System.in));

		try{
		String str=reader.readLine();
		array=str.split(" ");

		len=array.length;

		Stack stack=new Stack(len);
		int tmp;

		for(int i=0;i<len;i++){
			switch(array[i]){
			case"+":
				tmp=stack.pop()+stack.pop();
				stack.push(tmp);
				break;
			case"-":
				tmp=stack.pop()-stack.pop();
				stack.push(-tmp);
				break;
			case"*":
				tmp=stack.pop()*stack.pop();
				stack.push(tmp);
				break;
			default:
				tmp=Integer.parseInt(array[i]);
				stack.push(tmp);
			}//swicth

		}//for

		System.out.println(stack.pop());



		}catch(IOException e){

		}

	} int len; len String array[]; array BufferedReader reader=new BufferedReader(new InputStreamReader(System.in)); reader new BufferedReader(new InputStreamReader(System.in)) try{
		String str=reader.readLine();
		array=str.split(" ");

		len=array.length;

		Stack stack=new Stack(len);
		int tmp;

		for(int i=0;i<len;i++){
			switch(array[i]){
			case"+":
				tmp=stack.pop()+stack.pop();
				stack.push(tmp);
				break;
			case"-":
				tmp=stack.pop()-stack.pop();
				stack.push(-tmp);
				break;
			case"*":
				tmp=stack.pop()*stack.pop();
				stack.push(tmp);
				break;
			default:
				tmp=Integer.parseInt(array[i]);
				stack.push(tmp);
			}//swicth

		}//for

		System.out.println(stack.pop());



		}catch(IOException e){

		} catch(IOException e){

		} IOException e {

		} {
		String str=reader.readLine();
		array=str.split(" ");

		len=array.length;

		Stack stack=new Stack(len);
		int tmp;

		for(int i=0;i<len;i++){
			switch(array[i]){
			case"+":
				tmp=stack.pop()+stack.pop();
				stack.push(tmp);
				break;
			case"-":
				tmp=stack.pop()-stack.pop();
				stack.push(-tmp);
				break;
			case"*":
				tmp=stack.pop()*stack.pop();
				stack.push(tmp);
				break;
			default:
				tmp=Integer.parseInt(array[i]);
				stack.push(tmp);
			}//swicth

		}//for

		System.out.println(stack.pop());



		} String str=reader.readLine(); str reader.readLine() reader.readLine reader array=str.split(" ") array str.split(" ") str.split str " " len=array.length len array.length array array.length Stack stack=new Stack(len); stack new Stack(len) int tmp; tmp for(int i=0;i<len;i++){
			switch(array[i]){
			case"+":
				tmp=stack.pop()+stack.pop();
				stack.push(tmp);
				break;
			case"-":
				tmp=stack.pop()-stack.pop();
				stack.push(-tmp);
				break;
			case"*":
				tmp=stack.pop()*stack.pop();
				stack.push(tmp);
				break;
			default:
				tmp=Integer.parseInt(array[i]);
				stack.push(tmp);
			}//swicth

		}//for int i=0; int i=0; i 0 i<len i len i++ i++ i {
			switch(array[i]){
			case"+":
				tmp=stack.pop()+stack.pop();
				stack.push(tmp);
				break;
			case"-":
				tmp=stack.pop()-stack.pop();
				stack.push(-tmp);
				break;
			case"*":
				tmp=stack.pop()*stack.pop();
				stack.push(tmp);
				break;
			default:
				tmp=Integer.parseInt(array[i]);
				stack.push(tmp);
			}//swicth

		}//for {
			switch(array[i]){
			case"+":
				tmp=stack.pop()+stack.pop();
				stack.push(tmp);
				break;
			case"-":
				tmp=stack.pop()-stack.pop();
				stack.push(-tmp);
				break;
			case"*":
				tmp=stack.pop()*stack.pop();
				stack.push(tmp);
				break;
			default:
				tmp=Integer.parseInt(array[i]);
				stack.push(tmp);
			}//swicth

		} switch(array[i]){
			case"+":
				tmp=stack.pop()+stack.pop();
				stack.push(tmp);
				break;
			case"-":
				tmp=stack.pop()-stack.pop();
				stack.push(-tmp);
				break;
			case"*":
				tmp=stack.pop()*stack.pop();
				stack.push(tmp);
				break;
			default:
				tmp=Integer.parseInt(array[i]);
				stack.push(tmp);
			}//swicth array[i] array i case"+": "+" case"+": tmp=stack.pop()+stack.pop() tmp stack.pop()+stack.pop() stack.pop() stack.pop stack stack.pop() stack.pop stack stack.push(tmp) stack.push stack tmp break; case"-": "-" case"-": tmp=stack.pop()-stack.pop() tmp stack.pop()-stack.pop() stack.pop() stack.pop stack stack.pop() stack.pop stack stack.push(-tmp) stack.push stack -tmp tmp break; case"*": "*" case"*": tmp=stack.pop()*stack.pop() tmp stack.pop()*stack.pop() stack.pop() stack.pop stack stack.pop() stack.pop stack stack.push(tmp) stack.push stack tmp break; default: default: tmp=Integer.parseInt(array[i]) tmp Integer.parseInt(array[i]) Integer.parseInt Integer array[i] array i stack.push(tmp) stack.push stack tmp System.out.println(stack.pop()) System.out.println System.out System System.out stack.pop() stack.pop stack String[] args args class Stack{
	int max;
	int ptr;
	int[] array;

	Stack(int capacity){//?????????????????????
		max=capacity;
		ptr=0;
		array=new int[max];
	}

	public void push(int p){
		if(ptr<=max)array[ptr++]=p;
	}//push????????????

	public int pop(){
		if(ptr>0)return array[--ptr];
		else return -1;
	}//pop????????????

}//stack????????? Stack int max; max int ptr; ptr int[] array; array Stack(int capacity){//?????????????????????
		max=capacity;
		ptr=0;
		array=new int[max];
	} Stack {//?????????????????????
		max=capacity;
		ptr=0;
		array=new int[max];
	} max=capacity max capacity ptr=0 ptr 0 array=new int[max] array new int[max] max int capacity capacity public void push(int p){
		if(ptr<=max)array[ptr++]=p;
	}//push???????????? push {
		if(ptr<=max)array[ptr++]=p;
	} if(ptr<=max)array[ptr++]=p; ptr<=max ptr max array[ptr++]=p array[ptr++] array ptr++ ptr p int p p public int pop(){
		if(ptr>0)return array[--ptr];
		else return -1;
	}//pop???????????? pop {
		if(ptr>0)return array[--ptr];
		else return -1;
	} if(ptr>0)return array[--ptr];
		else return -1; ptr>0 ptr 0 return array[--ptr]; array[--ptr] array --ptr ptr return -1; -1 1 public class Main{




	public static void main(String[] args){

		int len;
		String array[];

		BufferedReader reader=new BufferedReader(new InputStreamReader(System.in));

		try{
		String str=reader.readLine();
		array=str.split(" ");

		len=array.length;

		Stack stack=new Stack(len);
		int tmp;

		for(int i=0;i<len;i++){
			switch(array[i]){
			case"+":
				tmp=stack.pop()+stack.pop();
				stack.push(tmp);
				break;
			case"-":
				tmp=stack.pop()-stack.pop();
				stack.push(-tmp);
				break;
			case"*":
				tmp=stack.pop()*stack.pop();
				stack.push(tmp);
				break;
			default:
				tmp=Integer.parseInt(array[i]);
				stack.push(tmp);
			}//swicth

		}//for

		System.out.println(stack.pop());



		}catch(IOException e){

		}

	}//main
} public class Main{




	public static void main(String[] args){

		int len;
		String array[];

		BufferedReader reader=new BufferedReader(new InputStreamReader(System.in));

		try{
		String str=reader.readLine();
		array=str.split(" ");

		len=array.length;

		Stack stack=new Stack(len);
		int tmp;

		for(int i=0;i<len;i++){
			switch(array[i]){
			case"+":
				tmp=stack.pop()+stack.pop();
				stack.push(tmp);
				break;
			case"-":
				tmp=stack.pop()-stack.pop();
				stack.push(-tmp);
				break;
			case"*":
				tmp=stack.pop()*stack.pop();
				stack.push(tmp);
				break;
			default:
				tmp=Integer.parseInt(array[i]);
				stack.push(tmp);
			}//swicth

		}//for

		System.out.println(stack.pop());



		}catch(IOException e){

		}

	}//main
} Main
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main{




	public static void main(String[] args){

		int len;
		String array[];

		BufferedReader reader=new BufferedReader(new InputStreamReader(System.in));

		try{
		String str=reader.readLine();
		array=str.split(" ");

		len=array.length;

		Stack stack=new Stack(len);
		int tmp;

		for(int i=0;i<len;i++){
			switch(array[i]){
			case"+":
				tmp=stack.pop()+stack.pop();
				stack.push(tmp);
				break;
			case"-":
				tmp=stack.pop()-stack.pop();
				stack.push(-tmp);
				break;
			case"*":
				tmp=stack.pop()*stack.pop();
				stack.push(tmp);
				break;
			default:
				tmp=Integer.parseInt(array[i]);
				stack.push(tmp);
			}//swicth

		}//for

		System.out.println(stack.pop());



		}catch(IOException e){

		}

	}//main
}

class Stack{
	int max;
	int ptr;
	int[] array;

	Stack(int capacity){//?????????????????????
		max=capacity;
		ptr=0;
		array=new int[max];
	}

	public void push(int p){
		if(ptr<=max)array[ptr++]=p;
	}//push????????????

	public int pop(){
		if(ptr>0)return array[--ptr];
		else return -1;
	}//pop????????????

}//stack?????????