import java.io.*;

class Main{
	public static void main(String[] args){
		try{
			BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
			String cmd[] = br.readLine().split(" ", 0);
			int S[] = new int[100];
			for(int i=0, p=0; i<cmd.length; i++){
				if(cmd[i].equals("+")){
					p--;
					S[p-1] += S[p];
				} else if(cmd[i].equals("-")){
					p--;
					S[p-1] -= S[p];
				} else if(cmd[i].equals("*")){
					p--;
					S[p-1] *= S[p];
				} else{
					S[p] = Integer.parseInt(""+cmd[i]);
					p++;
				}
			}
			System.out.println(S[0]);
		} catch(IOException e){
			System.out.println("Exception :" + e);
		}
	}
} import java.io.*; io.* java class Main{
	public static void main(String[] args){
		try{
			BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
			String cmd[] = br.readLine().split(" ", 0);
			int S[] = new int[100];
			for(int i=0, p=0; i<cmd.length; i++){
				if(cmd[i].equals("+")){
					p--;
					S[p-1] += S[p];
				} else if(cmd[i].equals("-")){
					p--;
					S[p-1] -= S[p];
				} else if(cmd[i].equals("*")){
					p--;
					S[p-1] *= S[p];
				} else{
					S[p] = Integer.parseInt(""+cmd[i]);
					p++;
				}
			}
			System.out.println(S[0]);
		} catch(IOException e){
			System.out.println("Exception :" + e);
		}
	}
} Main public static void main(String[] args){
		try{
			BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
			String cmd[] = br.readLine().split(" ", 0);
			int S[] = new int[100];
			for(int i=0, p=0; i<cmd.length; i++){
				if(cmd[i].equals("+")){
					p--;
					S[p-1] += S[p];
				} else if(cmd[i].equals("-")){
					p--;
					S[p-1] -= S[p];
				} else if(cmd[i].equals("*")){
					p--;
					S[p-1] *= S[p];
				} else{
					S[p] = Integer.parseInt(""+cmd[i]);
					p++;
				}
			}
			System.out.println(S[0]);
		} catch(IOException e){
			System.out.println("Exception :" + e);
		}
	} main {
		try{
			BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
			String cmd[] = br.readLine().split(" ", 0);
			int S[] = new int[100];
			for(int i=0, p=0; i<cmd.length; i++){
				if(cmd[i].equals("+")){
					p--;
					S[p-1] += S[p];
				} else if(cmd[i].equals("-")){
					p--;
					S[p-1] -= S[p];
				} else if(cmd[i].equals("*")){
					p--;
					S[p-1] *= S[p];
				} else{
					S[p] = Integer.parseInt(""+cmd[i]);
					p++;
				}
			}
			System.out.println(S[0]);
		} catch(IOException e){
			System.out.println("Exception :" + e);
		}
	} try{
			BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
			String cmd[] = br.readLine().split(" ", 0);
			int S[] = new int[100];
			for(int i=0, p=0; i<cmd.length; i++){
				if(cmd[i].equals("+")){
					p--;
					S[p-1] += S[p];
				} else if(cmd[i].equals("-")){
					p--;
					S[p-1] -= S[p];
				} else if(cmd[i].equals("*")){
					p--;
					S[p-1] *= S[p];
				} else{
					S[p] = Integer.parseInt(""+cmd[i]);
					p++;
				}
			}
			System.out.println(S[0]);
		} catch(IOException e){
			System.out.println("Exception :" + e);
		} catch(IOException e){
			System.out.println("Exception :" + e);
		} IOException e {
			System.out.println("Exception :" + e);
		} System.out.println("Exception :" + e) System.out.println System.out System System.out "Exception :" + e "Exception :" e {
			BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
			String cmd[] = br.readLine().split(" ", 0);
			int S[] = new int[100];
			for(int i=0, p=0; i<cmd.length; i++){
				if(cmd[i].equals("+")){
					p--;
					S[p-1] += S[p];
				} else if(cmd[i].equals("-")){
					p--;
					S[p-1] -= S[p];
				} else if(cmd[i].equals("*")){
					p--;
					S[p-1] *= S[p];
				} else{
					S[p] = Integer.parseInt(""+cmd[i]);
					p++;
				}
			}
			System.out.println(S[0]);
		} BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); br new BufferedReader(new InputStreamReader(System.in)) String cmd[] = br.readLine().split(" ", 0); cmd br.readLine().split(" ", 0) br.readLine().split br.readLine() br.readLine br " " 0 int S[] = new int[100]; S new int[100] 100 for(int i=0, p=0; i<cmd.length; i++){
				if(cmd[i].equals("+")){
					p--;
					S[p-1] += S[p];
				} else if(cmd[i].equals("-")){
					p--;
					S[p-1] -= S[p];
				} else if(cmd[i].equals("*")){
					p--;
					S[p-1] *= S[p];
				} else{
					S[p] = Integer.parseInt(""+cmd[i]);
					p++;
				}
			} int i=0, p=0; int i=0 i 0 p=0; p 0 i<cmd.length i cmd.length cmd cmd.length i++ i++ i {
				if(cmd[i].equals("+")){
					p--;
					S[p-1] += S[p];
				} else if(cmd[i].equals("-")){
					p--;
					S[p-1] -= S[p];
				} else if(cmd[i].equals("*")){
					p--;
					S[p-1] *= S[p];
				} else{
					S[p] = Integer.parseInt(""+cmd[i]);
					p++;
				}
			} {
				if(cmd[i].equals("+")){
					p--;
					S[p-1] += S[p];
				} else if(cmd[i].equals("-")){
					p--;
					S[p-1] -= S[p];
				} else if(cmd[i].equals("*")){
					p--;
					S[p-1] *= S[p];
				} else{
					S[p] = Integer.parseInt(""+cmd[i]);
					p++;
				}
			} if(cmd[i].equals("+")){
					p--;
					S[p-1] += S[p];
				} else if(cmd[i].equals("-")){
					p--;
					S[p-1] -= S[p];
				} else if(cmd[i].equals("*")){
					p--;
					S[p-1] *= S[p];
				} else{
					S[p] = Integer.parseInt(""+cmd[i]);
					p++;
				} cmd[i].equals("+") cmd[i].equals cmd[i] cmd i "+" {
					p--;
					S[p-1] += S[p];
				} p-- p S[p-1] += S[p] S[p-1] S p-1 p 1 S[p] S p if(cmd[i].equals("-")){
					p--;
					S[p-1] -= S[p];
				} else if(cmd[i].equals("*")){
					p--;
					S[p-1] *= S[p];
				} else{
					S[p] = Integer.parseInt(""+cmd[i]);
					p++;
				} cmd[i].equals("-") cmd[i].equals cmd[i] cmd i "-" {
					p--;
					S[p-1] -= S[p];
				} p-- p S[p-1] -= S[p] S[p-1] S p-1 p 1 S[p] S p if(cmd[i].equals("*")){
					p--;
					S[p-1] *= S[p];
				} else{
					S[p] = Integer.parseInt(""+cmd[i]);
					p++;
				} cmd[i].equals("*") cmd[i].equals cmd[i] cmd i "*" {
					p--;
					S[p-1] *= S[p];
				} p-- p S[p-1] *= S[p] S[p-1] S p-1 p 1 S[p] S p {
					S[p] = Integer.parseInt(""+cmd[i]);
					p++;
				} S[p] = Integer.parseInt(""+cmd[i]) S[p] S p Integer.parseInt(""+cmd[i]) Integer.parseInt Integer ""+cmd[i] "" cmd[i] cmd i p++ p System.out.println(S[0]) System.out.println System.out System System.out S[0] S 0 String[] args args
import java.io.*;

class Main{
	public static void main(String[] args){
		try{
			BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
			String cmd[] = br.readLine().split(" ", 0);
			int S[] = new int[100];
			for(int i=0, p=0; i<cmd.length; i++){
				if(cmd[i].equals("+")){
					p--;
					S[p-1] += S[p];
				} else if(cmd[i].equals("-")){
					p--;
					S[p-1] -= S[p];
				} else if(cmd[i].equals("*")){
					p--;
					S[p-1] *= S[p];
				} else{
					S[p] = Integer.parseInt(""+cmd[i]);
					p++;
				}
			}
			System.out.println(S[0]);
		} catch(IOException e){
			System.out.println("Exception :" + e);
		}
	}
}