import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.HashMap;
import java.util.LinkedList;
import java.util.Map;
import java.util.Scanner;

public class Main {
	
	public static void main(String args[]) {
		Scanner sc = new Scanner(System.in);
		
		LinkedList<String> input = new LinkedList<String>();
		while(sc.hasNext()){
			input.addLast(sc.next());
		}
		LinkedList<String> rest = new LinkedList<String>();
		
		while(!input.isEmpty()){
			//System.out.println(input + " " + rest);
			final int a = Integer.parseInt(input.poll());
			if(input.isEmpty()){
				System.out.println(a);
				break;
			}
			
			final int b = Integer.parseInt(input.poll());
			final String ops = input.poll();
			
			if("+".equals(ops)){
				input.addFirst((a + b) + "");
				while(!rest.isEmpty()){
					input.addFirst(rest.poll());
				}
			}else if("-".equals(ops)){
				input.addFirst((a - b) + "");
				while(!rest.isEmpty()){
					input.addFirst(rest.poll());
				}
			}else if("*".equals(ops)){
				input.addFirst((a * b) + "");
				while(!rest.isEmpty()){
					input.addFirst(rest.poll());
				}
			}else if("/".equals(ops)){
				input.addFirst((a / b) + "");
				while(!rest.isEmpty()){
					input.addFirst(rest.poll());
				}
			}else{
				rest.addFirst(a + "");
				input.addFirst(ops);
				input.addFirst(b + "");
			}
		}
		
	}
} import java.io.BufferedReader; BufferedReader java.io import java.io.IOException; IOException java.io import java.io.InputStreamReader; InputStreamReader java.io import java.util.Arrays; Arrays java.util import java.util.HashMap; HashMap java.util import java.util.LinkedList; LinkedList java.util import java.util.Map; Map java.util import java.util.Scanner; Scanner java.util public class Main {
	
	public static void main(String args[]) {
		Scanner sc = new Scanner(System.in);
		
		LinkedList<String> input = new LinkedList<String>();
		while(sc.hasNext()){
			input.addLast(sc.next());
		}
		LinkedList<String> rest = new LinkedList<String>();
		
		while(!input.isEmpty()){
			//System.out.println(input + " " + rest);
			final int a = Integer.parseInt(input.poll());
			if(input.isEmpty()){
				System.out.println(a);
				break;
			}
			
			final int b = Integer.parseInt(input.poll());
			final String ops = input.poll();
			
			if("+".equals(ops)){
				input.addFirst((a + b) + "");
				while(!rest.isEmpty()){
					input.addFirst(rest.poll());
				}
			}else if("-".equals(ops)){
				input.addFirst((a - b) + "");
				while(!rest.isEmpty()){
					input.addFirst(rest.poll());
				}
			}else if("*".equals(ops)){
				input.addFirst((a * b) + "");
				while(!rest.isEmpty()){
					input.addFirst(rest.poll());
				}
			}else if("/".equals(ops)){
				input.addFirst((a / b) + "");
				while(!rest.isEmpty()){
					input.addFirst(rest.poll());
				}
			}else{
				rest.addFirst(a + "");
				input.addFirst(ops);
				input.addFirst(b + "");
			}
		}
		
	}
} Main public static void main(String args[]) {
		Scanner sc = new Scanner(System.in);
		
		LinkedList<String> input = new LinkedList<String>();
		while(sc.hasNext()){
			input.addLast(sc.next());
		}
		LinkedList<String> rest = new LinkedList<String>();
		
		while(!input.isEmpty()){
			//System.out.println(input + " " + rest);
			final int a = Integer.parseInt(input.poll());
			if(input.isEmpty()){
				System.out.println(a);
				break;
			}
			
			final int b = Integer.parseInt(input.poll());
			final String ops = input.poll();
			
			if("+".equals(ops)){
				input.addFirst((a + b) + "");
				while(!rest.isEmpty()){
					input.addFirst(rest.poll());
				}
			}else if("-".equals(ops)){
				input.addFirst((a - b) + "");
				while(!rest.isEmpty()){
					input.addFirst(rest.poll());
				}
			}else if("*".equals(ops)){
				input.addFirst((a * b) + "");
				while(!rest.isEmpty()){
					input.addFirst(rest.poll());
				}
			}else if("/".equals(ops)){
				input.addFirst((a / b) + "");
				while(!rest.isEmpty()){
					input.addFirst(rest.poll());
				}
			}else{
				rest.addFirst(a + "");
				input.addFirst(ops);
				input.addFirst(b + "");
			}
		}
		
	} main {
		Scanner sc = new Scanner(System.in);
		
		LinkedList<String> input = new LinkedList<String>();
		while(sc.hasNext()){
			input.addLast(sc.next());
		}
		LinkedList<String> rest = new LinkedList<String>();
		
		while(!input.isEmpty()){
			//System.out.println(input + " " + rest);
			final int a = Integer.parseInt(input.poll());
			if(input.isEmpty()){
				System.out.println(a);
				break;
			}
			
			final int b = Integer.parseInt(input.poll());
			final String ops = input.poll();
			
			if("+".equals(ops)){
				input.addFirst((a + b) + "");
				while(!rest.isEmpty()){
					input.addFirst(rest.poll());
				}
			}else if("-".equals(ops)){
				input.addFirst((a - b) + "");
				while(!rest.isEmpty()){
					input.addFirst(rest.poll());
				}
			}else if("*".equals(ops)){
				input.addFirst((a * b) + "");
				while(!rest.isEmpty()){
					input.addFirst(rest.poll());
				}
			}else if("/".equals(ops)){
				input.addFirst((a / b) + "");
				while(!rest.isEmpty()){
					input.addFirst(rest.poll());
				}
			}else{
				rest.addFirst(a + "");
				input.addFirst(ops);
				input.addFirst(b + "");
			}
		}
		
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) LinkedList<String> input = new LinkedList<String>(); input new LinkedList<String>() while(sc.hasNext()){
			input.addLast(sc.next());
		} sc.hasNext() sc.hasNext sc {
			input.addLast(sc.next());
		} input.addLast(sc.next()) input.addLast input sc.next() sc.next sc LinkedList<String> rest = new LinkedList<String>(); rest new LinkedList<String>() while(!input.isEmpty()){
			//System.out.println(input + " " + rest);
			final int a = Integer.parseInt(input.poll());
			if(input.isEmpty()){
				System.out.println(a);
				break;
			}
			
			final int b = Integer.parseInt(input.poll());
			final String ops = input.poll();
			
			if("+".equals(ops)){
				input.addFirst((a + b) + "");
				while(!rest.isEmpty()){
					input.addFirst(rest.poll());
				}
			}else if("-".equals(ops)){
				input.addFirst((a - b) + "");
				while(!rest.isEmpty()){
					input.addFirst(rest.poll());
				}
			}else if("*".equals(ops)){
				input.addFirst((a * b) + "");
				while(!rest.isEmpty()){
					input.addFirst(rest.poll());
				}
			}else if("/".equals(ops)){
				input.addFirst((a / b) + "");
				while(!rest.isEmpty()){
					input.addFirst(rest.poll());
				}
			}else{
				rest.addFirst(a + "");
				input.addFirst(ops);
				input.addFirst(b + "");
			}
		} !input.isEmpty() input.isEmpty() input.isEmpty input {
			//System.out.println(input + " " + rest);
			final int a = Integer.parseInt(input.poll());
			if(input.isEmpty()){
				System.out.println(a);
				break;
			}
			
			final int b = Integer.parseInt(input.poll());
			final String ops = input.poll();
			
			if("+".equals(ops)){
				input.addFirst((a + b) + "");
				while(!rest.isEmpty()){
					input.addFirst(rest.poll());
				}
			}else if("-".equals(ops)){
				input.addFirst((a - b) + "");
				while(!rest.isEmpty()){
					input.addFirst(rest.poll());
				}
			}else if("*".equals(ops)){
				input.addFirst((a * b) + "");
				while(!rest.isEmpty()){
					input.addFirst(rest.poll());
				}
			}else if("/".equals(ops)){
				input.addFirst((a / b) + "");
				while(!rest.isEmpty()){
					input.addFirst(rest.poll());
				}
			}else{
				rest.addFirst(a + "");
				input.addFirst(ops);
				input.addFirst(b + "");
			}
		} final int a = Integer.parseInt(input.poll()); a Integer.parseInt(input.poll()) Integer.parseInt Integer input.poll() input.poll input if(input.isEmpty()){
				System.out.println(a);
				break;
			} input.isEmpty() input.isEmpty input {
				System.out.println(a);
				break;
			} System.out.println(a) System.out.println System.out System System.out a break; final int b = Integer.parseInt(input.poll()); b Integer.parseInt(input.poll()) Integer.parseInt Integer input.poll() input.poll input final String ops = input.poll(); ops input.poll() input.poll input if("+".equals(ops)){
				input.addFirst((a + b) + "");
				while(!rest.isEmpty()){
					input.addFirst(rest.poll());
				}
			}else if("-".equals(ops)){
				input.addFirst((a - b) + "");
				while(!rest.isEmpty()){
					input.addFirst(rest.poll());
				}
			}else if("*".equals(ops)){
				input.addFirst((a * b) + "");
				while(!rest.isEmpty()){
					input.addFirst(rest.poll());
				}
			}else if("/".equals(ops)){
				input.addFirst((a / b) + "");
				while(!rest.isEmpty()){
					input.addFirst(rest.poll());
				}
			}else{
				rest.addFirst(a + "");
				input.addFirst(ops);
				input.addFirst(b + "");
			} "+".equals(ops) "+".equals "+" ops {
				input.addFirst((a + b) + "");
				while(!rest.isEmpty()){
					input.addFirst(rest.poll());
				}
			} input.addFirst((a + b) + "") input.addFirst input (a + b) + "" (a + b) a b "" while(!rest.isEmpty()){
					input.addFirst(rest.poll());
				} !rest.isEmpty() rest.isEmpty() rest.isEmpty rest {
					input.addFirst(rest.poll());
				} input.addFirst(rest.poll()) input.addFirst input rest.poll() rest.poll rest if("-".equals(ops)){
				input.addFirst((a - b) + "");
				while(!rest.isEmpty()){
					input.addFirst(rest.poll());
				}
			}else if("*".equals(ops)){
				input.addFirst((a * b) + "");
				while(!rest.isEmpty()){
					input.addFirst(rest.poll());
				}
			}else if("/".equals(ops)){
				input.addFirst((a / b) + "");
				while(!rest.isEmpty()){
					input.addFirst(rest.poll());
				}
			}else{
				rest.addFirst(a + "");
				input.addFirst(ops);
				input.addFirst(b + "");
			} "-".equals(ops) "-".equals "-" ops {
				input.addFirst((a - b) + "");
				while(!rest.isEmpty()){
					input.addFirst(rest.poll());
				}
			} input.addFirst((a - b) + "") input.addFirst input (a - b) + "" (a - b) a b "" while(!rest.isEmpty()){
					input.addFirst(rest.poll());
				} !rest.isEmpty() rest.isEmpty() rest.isEmpty rest {
					input.addFirst(rest.poll());
				} input.addFirst(rest.poll()) input.addFirst input rest.poll() rest.poll rest if("*".equals(ops)){
				input.addFirst((a * b) + "");
				while(!rest.isEmpty()){
					input.addFirst(rest.poll());
				}
			}else if("/".equals(ops)){
				input.addFirst((a / b) + "");
				while(!rest.isEmpty()){
					input.addFirst(rest.poll());
				}
			}else{
				rest.addFirst(a + "");
				input.addFirst(ops);
				input.addFirst(b + "");
			} "*".equals(ops) "*".equals "*" ops {
				input.addFirst((a * b) + "");
				while(!rest.isEmpty()){
					input.addFirst(rest.poll());
				}
			} input.addFirst((a * b) + "") input.addFirst input (a * b) + "" (a * b) a b "" while(!rest.isEmpty()){
					input.addFirst(rest.poll());
				} !rest.isEmpty() rest.isEmpty() rest.isEmpty rest {
					input.addFirst(rest.poll());
				} input.addFirst(rest.poll()) input.addFirst input rest.poll() rest.poll rest if("/".equals(ops)){
				input.addFirst((a / b) + "");
				while(!rest.isEmpty()){
					input.addFirst(rest.poll());
				}
			}else{
				rest.addFirst(a + "");
				input.addFirst(ops);
				input.addFirst(b + "");
			} "/".equals(ops) "/".equals "/" ops {
				input.addFirst((a / b) + "");
				while(!rest.isEmpty()){
					input.addFirst(rest.poll());
				}
			} input.addFirst((a / b) + "") input.addFirst input (a / b) + "" (a / b) a b "" while(!rest.isEmpty()){
					input.addFirst(rest.poll());
				} !rest.isEmpty() rest.isEmpty() rest.isEmpty rest {
					input.addFirst(rest.poll());
				} input.addFirst(rest.poll()) input.addFirst input rest.poll() rest.poll rest {
				rest.addFirst(a + "");
				input.addFirst(ops);
				input.addFirst(b + "");
			} rest.addFirst(a + "") rest.addFirst rest a + "" a "" input.addFirst(ops) input.addFirst input ops input.addFirst(b + "") input.addFirst input b + "" b "" String args[] args public class Main {
	
	public static void main(String args[]) {
		Scanner sc = new Scanner(System.in);
		
		LinkedList<String> input = new LinkedList<String>();
		while(sc.hasNext()){
			input.addLast(sc.next());
		}
		LinkedList<String> rest = new LinkedList<String>();
		
		while(!input.isEmpty()){
			//System.out.println(input + " " + rest);
			final int a = Integer.parseInt(input.poll());
			if(input.isEmpty()){
				System.out.println(a);
				break;
			}
			
			final int b = Integer.parseInt(input.poll());
			final String ops = input.poll();
			
			if("+".equals(ops)){
				input.addFirst((a + b) + "");
				while(!rest.isEmpty()){
					input.addFirst(rest.poll());
				}
			}else if("-".equals(ops)){
				input.addFirst((a - b) + "");
				while(!rest.isEmpty()){
					input.addFirst(rest.poll());
				}
			}else if("*".equals(ops)){
				input.addFirst((a * b) + "");
				while(!rest.isEmpty()){
					input.addFirst(rest.poll());
				}
			}else if("/".equals(ops)){
				input.addFirst((a / b) + "");
				while(!rest.isEmpty()){
					input.addFirst(rest.poll());
				}
			}else{
				rest.addFirst(a + "");
				input.addFirst(ops);
				input.addFirst(b + "");
			}
		}
		
	}
} public class Main {
	
	public static void main(String args[]) {
		Scanner sc = new Scanner(System.in);
		
		LinkedList<String> input = new LinkedList<String>();
		while(sc.hasNext()){
			input.addLast(sc.next());
		}
		LinkedList<String> rest = new LinkedList<String>();
		
		while(!input.isEmpty()){
			//System.out.println(input + " " + rest);
			final int a = Integer.parseInt(input.poll());
			if(input.isEmpty()){
				System.out.println(a);
				break;
			}
			
			final int b = Integer.parseInt(input.poll());
			final String ops = input.poll();
			
			if("+".equals(ops)){
				input.addFirst((a + b) + "");
				while(!rest.isEmpty()){
					input.addFirst(rest.poll());
				}
			}else if("-".equals(ops)){
				input.addFirst((a - b) + "");
				while(!rest.isEmpty()){
					input.addFirst(rest.poll());
				}
			}else if("*".equals(ops)){
				input.addFirst((a * b) + "");
				while(!rest.isEmpty()){
					input.addFirst(rest.poll());
				}
			}else if("/".equals(ops)){
				input.addFirst((a / b) + "");
				while(!rest.isEmpty()){
					input.addFirst(rest.poll());
				}
			}else{
				rest.addFirst(a + "");
				input.addFirst(ops);
				input.addFirst(b + "");
			}
		}
		
	}
} Main
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.HashMap;
import java.util.LinkedList;
import java.util.Map;
import java.util.Scanner;

public class Main {
	
	public static void main(String args[]) {
		Scanner sc = new Scanner(System.in);
		
		LinkedList<String> input = new LinkedList<String>();
		while(sc.hasNext()){
			input.addLast(sc.next());
		}
		LinkedList<String> rest = new LinkedList<String>();
		
		while(!input.isEmpty()){
			//System.out.println(input + " " + rest);
			final int a = Integer.parseInt(input.poll());
			if(input.isEmpty()){
				System.out.println(a);
				break;
			}
			
			final int b = Integer.parseInt(input.poll());
			final String ops = input.poll();
			
			if("+".equals(ops)){
				input.addFirst((a + b) + "");
				while(!rest.isEmpty()){
					input.addFirst(rest.poll());
				}
			}else if("-".equals(ops)){
				input.addFirst((a - b) + "");
				while(!rest.isEmpty()){
					input.addFirst(rest.poll());
				}
			}else if("*".equals(ops)){
				input.addFirst((a * b) + "");
				while(!rest.isEmpty()){
					input.addFirst(rest.poll());
				}
			}else if("/".equals(ops)){
				input.addFirst((a / b) + "");
				while(!rest.isEmpty()){
					input.addFirst(rest.poll());
				}
			}else{
				rest.addFirst(a + "");
				input.addFirst(ops);
				input.addFirst(b + "");
			}
		}
		
	}
}