
import java.io.*;
public class Main{
	public static void main(String[] args)throws Exception{
		BufferedReader br=new BufferedReader(
			new InputStreamReader(System.in));
		int[] a=new int[512];
		int c=0;
		String l[]=br.readLine().split(" ");
		for(int i=0;i<l.length;i++){
			switch(l[i]){
				case "+":c--;if(c-1>=0)a[c-1]=a[c-1]+a[c];break;
				case "-":c--;if(c-1>=0)a[c-1]=a[c-1]-a[c];break;
				case "*":c--;if(c-1>=0)a[c-1]=a[c-1]*a[c];break;
				default:a[c]=Integer.parseInt(l[i]);c++;break;
			}
		}
		System.out.println(a[0]);
	}
} import java.io.*; io.* java public class Main{
	public static void main(String[] args)throws Exception{
		BufferedReader br=new BufferedReader(
			new InputStreamReader(System.in));
		int[] a=new int[512];
		int c=0;
		String l[]=br.readLine().split(" ");
		for(int i=0;i<l.length;i++){
			switch(l[i]){
				case "+":c--;if(c-1>=0)a[c-1]=a[c-1]+a[c];break;
				case "-":c--;if(c-1>=0)a[c-1]=a[c-1]-a[c];break;
				case "*":c--;if(c-1>=0)a[c-1]=a[c-1]*a[c];break;
				default:a[c]=Integer.parseInt(l[i]);c++;break;
			}
		}
		System.out.println(a[0]);
	}
} Main public static void main(String[] args)throws Exception{
		BufferedReader br=new BufferedReader(
			new InputStreamReader(System.in));
		int[] a=new int[512];
		int c=0;
		String l[]=br.readLine().split(" ");
		for(int i=0;i<l.length;i++){
			switch(l[i]){
				case "+":c--;if(c-1>=0)a[c-1]=a[c-1]+a[c];break;
				case "-":c--;if(c-1>=0)a[c-1]=a[c-1]-a[c];break;
				case "*":c--;if(c-1>=0)a[c-1]=a[c-1]*a[c];break;
				default:a[c]=Integer.parseInt(l[i]);c++;break;
			}
		}
		System.out.println(a[0]);
	} main {
		BufferedReader br=new BufferedReader(
			new InputStreamReader(System.in));
		int[] a=new int[512];
		int c=0;
		String l[]=br.readLine().split(" ");
		for(int i=0;i<l.length;i++){
			switch(l[i]){
				case "+":c--;if(c-1>=0)a[c-1]=a[c-1]+a[c];break;
				case "-":c--;if(c-1>=0)a[c-1]=a[c-1]-a[c];break;
				case "*":c--;if(c-1>=0)a[c-1]=a[c-1]*a[c];break;
				default:a[c]=Integer.parseInt(l[i]);c++;break;
			}
		}
		System.out.println(a[0]);
	} BufferedReader br=new BufferedReader(
			new InputStreamReader(System.in)); br new BufferedReader(
			new InputStreamReader(System.in)) int[] a=new int[512]; a new int[512] 512 int c=0; c 0 String l[]=br.readLine().split(" "); l br.readLine().split(" ") br.readLine().split br.readLine() br.readLine br " " for(int i=0;i<l.length;i++){
			switch(l[i]){
				case "+":c--;if(c-1>=0)a[c-1]=a[c-1]+a[c];break;
				case "-":c--;if(c-1>=0)a[c-1]=a[c-1]-a[c];break;
				case "*":c--;if(c-1>=0)a[c-1]=a[c-1]*a[c];break;
				default:a[c]=Integer.parseInt(l[i]);c++;break;
			}
		} int i=0; int i=0; i 0 i<l.length i l.length l l.length i++ i++ i {
			switch(l[i]){
				case "+":c--;if(c-1>=0)a[c-1]=a[c-1]+a[c];break;
				case "-":c--;if(c-1>=0)a[c-1]=a[c-1]-a[c];break;
				case "*":c--;if(c-1>=0)a[c-1]=a[c-1]*a[c];break;
				default:a[c]=Integer.parseInt(l[i]);c++;break;
			}
		} {
			switch(l[i]){
				case "+":c--;if(c-1>=0)a[c-1]=a[c-1]+a[c];break;
				case "-":c--;if(c-1>=0)a[c-1]=a[c-1]-a[c];break;
				case "*":c--;if(c-1>=0)a[c-1]=a[c-1]*a[c];break;
				default:a[c]=Integer.parseInt(l[i]);c++;break;
			}
		} switch(l[i]){
				case "+":c--;if(c-1>=0)a[c-1]=a[c-1]+a[c];break;
				case "-":c--;if(c-1>=0)a[c-1]=a[c-1]-a[c];break;
				case "*":c--;if(c-1>=0)a[c-1]=a[c-1]*a[c];break;
				default:a[c]=Integer.parseInt(l[i]);c++;break;
			} l[i] l i case "+": "+" case "+": c-- c if(c-1>=0)a[c-1]=a[c-1]+a[c]; c-1>=0 c-1 c 1 0 a[c-1]=a[c-1]+a[c] a[c-1] a c-1 c 1 a[c-1]+a[c] a[c-1] a c-1 c 1 a[c] a c break; case "-": "-" case "-": c-- c if(c-1>=0)a[c-1]=a[c-1]-a[c]; c-1>=0 c-1 c 1 0 a[c-1]=a[c-1]-a[c] a[c-1] a c-1 c 1 a[c-1]-a[c] a[c-1] a c-1 c 1 a[c] a c break; case "*": "*" case "*": c-- c if(c-1>=0)a[c-1]=a[c-1]*a[c]; c-1>=0 c-1 c 1 0 a[c-1]=a[c-1]*a[c] a[c-1] a c-1 c 1 a[c-1]*a[c] a[c-1] a c-1 c 1 a[c] a c break; default: default: a[c]=Integer.parseInt(l[i]) a[c] a c Integer.parseInt(l[i]) Integer.parseInt Integer l[i] l i c++ c break; System.out.println(a[0]) System.out.println System.out System System.out a[0] a 0 String[] args args public class Main{
	public static void main(String[] args)throws Exception{
		BufferedReader br=new BufferedReader(
			new InputStreamReader(System.in));
		int[] a=new int[512];
		int c=0;
		String l[]=br.readLine().split(" ");
		for(int i=0;i<l.length;i++){
			switch(l[i]){
				case "+":c--;if(c-1>=0)a[c-1]=a[c-1]+a[c];break;
				case "-":c--;if(c-1>=0)a[c-1]=a[c-1]-a[c];break;
				case "*":c--;if(c-1>=0)a[c-1]=a[c-1]*a[c];break;
				default:a[c]=Integer.parseInt(l[i]);c++;break;
			}
		}
		System.out.println(a[0]);
	}
} public class Main{
	public static void main(String[] args)throws Exception{
		BufferedReader br=new BufferedReader(
			new InputStreamReader(System.in));
		int[] a=new int[512];
		int c=0;
		String l[]=br.readLine().split(" ");
		for(int i=0;i<l.length;i++){
			switch(l[i]){
				case "+":c--;if(c-1>=0)a[c-1]=a[c-1]+a[c];break;
				case "-":c--;if(c-1>=0)a[c-1]=a[c-1]-a[c];break;
				case "*":c--;if(c-1>=0)a[c-1]=a[c-1]*a[c];break;
				default:a[c]=Integer.parseInt(l[i]);c++;break;
			}
		}
		System.out.println(a[0]);
	}
} Main

import java.io.*;
public class Main{
	public static void main(String[] args)throws Exception{
		BufferedReader br=new BufferedReader(
			new InputStreamReader(System.in));
		int[] a=new int[512];
		int c=0;
		String l[]=br.readLine().split(" ");
		for(int i=0;i<l.length;i++){
			switch(l[i]){
				case "+":c--;if(c-1>=0)a[c-1]=a[c-1]+a[c];break;
				case "-":c--;if(c-1>=0)a[c-1]=a[c-1]-a[c];break;
				case "*":c--;if(c-1>=0)a[c-1]=a[c-1]*a[c];break;
				default:a[c]=Integer.parseInt(l[i]);c++;break;
			}
		}
		System.out.println(a[0]);
	}
}