import java.util.*;

public class Main {

	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		MyStack stack = new MyStack();

		while(in.hasNext()) {
			stack.push(in.next());
		}

		System.out.println(stack.peek());
	}

	static class MyStack{
		long[] arr;
		int tail;

		MyStack() {
			arr = new long[100];
			tail = -1;
		}

		void push(String str) {

			try {
				long v = Long.parseLong(str);
				//System.out.println("insert" + v);
                arr[++tail] = v;
                //System.out.println("tail" + tail);
			}catch(Exception e) {
                //System.out.println("calc operetion requested");
				char op = str.charAt(0);

				switch(op) {
					case '+': 
						long eq1 = arr[tail - 1] + arr[tail];
                        arr[tail - 1] = eq1;
                        tail--;
						break;

					case '-':
						long eq2 = arr[tail - 1] - arr[tail];
						arr[--tail] = eq2;
						break;

					case '*':
						long eq3 = arr[tail - 1] * arr[tail];
						arr[--tail] = eq3;
						break;
				}
			}
		}

		long peek() {
			return arr[tail];
		}
	}

}
 import java.util.*; util.* java public class Main {

	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		MyStack stack = new MyStack();

		while(in.hasNext()) {
			stack.push(in.next());
		}

		System.out.println(stack.peek());
	}

	static class MyStack{
		long[] arr;
		int tail;

		MyStack() {
			arr = new long[100];
			tail = -1;
		}

		void push(String str) {

			try {
				long v = Long.parseLong(str);
				//System.out.println("insert" + v);
                arr[++tail] = v;
                //System.out.println("tail" + tail);
			}catch(Exception e) {
                //System.out.println("calc operetion requested");
				char op = str.charAt(0);

				switch(op) {
					case '+': 
						long eq1 = arr[tail - 1] + arr[tail];
                        arr[tail - 1] = eq1;
                        tail--;
						break;

					case '-':
						long eq2 = arr[tail - 1] - arr[tail];
						arr[--tail] = eq2;
						break;

					case '*':
						long eq3 = arr[tail - 1] * arr[tail];
						arr[--tail] = eq3;
						break;
				}
			}
		}

		long peek() {
			return arr[tail];
		}
	}

} Main public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		MyStack stack = new MyStack();

		while(in.hasNext()) {
			stack.push(in.next());
		}

		System.out.println(stack.peek());
	} main {
		Scanner in = new Scanner(System.in);
		MyStack stack = new MyStack();

		while(in.hasNext()) {
			stack.push(in.next());
		}

		System.out.println(stack.peek());
	} Scanner in = new Scanner(System.in); in new Scanner(System.in) MyStack stack = new MyStack(); stack new MyStack() while(in.hasNext()) {
			stack.push(in.next());
		} in.hasNext() in.hasNext in {
			stack.push(in.next());
		} stack.push(in.next()) stack.push stack in.next() in.next in System.out.println(stack.peek()) System.out.println System.out System System.out stack.peek() stack.peek stack String[] args args static class MyStack{
		long[] arr;
		int tail;

		MyStack() {
			arr = new long[100];
			tail = -1;
		}

		void push(String str) {

			try {
				long v = Long.parseLong(str);
				//System.out.println("insert" + v);
                arr[++tail] = v;
                //System.out.println("tail" + tail);
			}catch(Exception e) {
                //System.out.println("calc operetion requested");
				char op = str.charAt(0);

				switch(op) {
					case '+': 
						long eq1 = arr[tail - 1] + arr[tail];
                        arr[tail - 1] = eq1;
                        tail--;
						break;

					case '-':
						long eq2 = arr[tail - 1] - arr[tail];
						arr[--tail] = eq2;
						break;

					case '*':
						long eq3 = arr[tail - 1] * arr[tail];
						arr[--tail] = eq3;
						break;
				}
			}
		}

		long peek() {
			return arr[tail];
		}
	} MyStack long[] arr; arr int tail; tail MyStack() {
			arr = new long[100];
			tail = -1;
		} MyStack {
			arr = new long[100];
			tail = -1;
		} arr = new long[100] arr new long[100] 100 tail = -1 tail -1 1 void push(String str) {

			try {
				long v = Long.parseLong(str);
				//System.out.println("insert" + v);
                arr[++tail] = v;
                //System.out.println("tail" + tail);
			}catch(Exception e) {
                //System.out.println("calc operetion requested");
				char op = str.charAt(0);

				switch(op) {
					case '+': 
						long eq1 = arr[tail - 1] + arr[tail];
                        arr[tail - 1] = eq1;
                        tail--;
						break;

					case '-':
						long eq2 = arr[tail - 1] - arr[tail];
						arr[--tail] = eq2;
						break;

					case '*':
						long eq3 = arr[tail - 1] * arr[tail];
						arr[--tail] = eq3;
						break;
				}
			}
		} push {

			try {
				long v = Long.parseLong(str);
				//System.out.println("insert" + v);
                arr[++tail] = v;
                //System.out.println("tail" + tail);
			}catch(Exception e) {
                //System.out.println("calc operetion requested");
				char op = str.charAt(0);

				switch(op) {
					case '+': 
						long eq1 = arr[tail - 1] + arr[tail];
                        arr[tail - 1] = eq1;
                        tail--;
						break;

					case '-':
						long eq2 = arr[tail - 1] - arr[tail];
						arr[--tail] = eq2;
						break;

					case '*':
						long eq3 = arr[tail - 1] * arr[tail];
						arr[--tail] = eq3;
						break;
				}
			}
		} try {
				long v = Long.parseLong(str);
				//System.out.println("insert" + v);
                arr[++tail] = v;
                //System.out.println("tail" + tail);
			}catch(Exception e) {
                //System.out.println("calc operetion requested");
				char op = str.charAt(0);

				switch(op) {
					case '+': 
						long eq1 = arr[tail - 1] + arr[tail];
                        arr[tail - 1] = eq1;
                        tail--;
						break;

					case '-':
						long eq2 = arr[tail - 1] - arr[tail];
						arr[--tail] = eq2;
						break;

					case '*':
						long eq3 = arr[tail - 1] * arr[tail];
						arr[--tail] = eq3;
						break;
				}
			} catch(Exception e) {
                //System.out.println("calc operetion requested");
				char op = str.charAt(0);

				switch(op) {
					case '+': 
						long eq1 = arr[tail - 1] + arr[tail];
                        arr[tail - 1] = eq1;
                        tail--;
						break;

					case '-':
						long eq2 = arr[tail - 1] - arr[tail];
						arr[--tail] = eq2;
						break;

					case '*':
						long eq3 = arr[tail - 1] * arr[tail];
						arr[--tail] = eq3;
						break;
				}
			} Exception e {
                //System.out.println("calc operetion requested");
				char op = str.charAt(0);

				switch(op) {
					case '+': 
						long eq1 = arr[tail - 1] + arr[tail];
                        arr[tail - 1] = eq1;
                        tail--;
						break;

					case '-':
						long eq2 = arr[tail - 1] - arr[tail];
						arr[--tail] = eq2;
						break;

					case '*':
						long eq3 = arr[tail - 1] * arr[tail];
						arr[--tail] = eq3;
						break;
				}
			} char op = str.charAt(0); op str.charAt(0) str.charAt str 0 switch(op) {
					case '+': 
						long eq1 = arr[tail - 1] + arr[tail];
                        arr[tail - 1] = eq1;
                        tail--;
						break;

					case '-':
						long eq2 = arr[tail - 1] - arr[tail];
						arr[--tail] = eq2;
						break;

					case '*':
						long eq3 = arr[tail - 1] * arr[tail];
						arr[--tail] = eq3;
						break;
				} op case '+': '+' case '+': long eq1 = arr[tail - 1] + arr[tail]; eq1 arr[tail - 1] + arr[tail] arr[tail - 1] arr tail - 1 tail 1 arr[tail] arr tail arr[tail - 1] = eq1 arr[tail - 1] arr tail - 1 tail 1 eq1 tail-- tail break; case '-': '-' case '-': long eq2 = arr[tail - 1] - arr[tail]; eq2 arr[tail - 1] - arr[tail] arr[tail - 1] arr tail - 1 tail 1 arr[tail] arr tail arr[--tail] = eq2 arr[--tail] arr --tail tail eq2 break; case '*': '*' case '*': long eq3 = arr[tail - 1] * arr[tail]; eq3 arr[tail - 1] * arr[tail] arr[tail - 1] arr tail - 1 tail 1 arr[tail] arr tail arr[--tail] = eq3 arr[--tail] arr --tail tail eq3 break; {
				long v = Long.parseLong(str);
				//System.out.println("insert" + v);
                arr[++tail] = v;
                //System.out.println("tail" + tail);
			} long v = Long.parseLong(str); v Long.parseLong(str) Long.parseLong Long str arr[++tail] = v arr[++tail] arr ++tail tail v String str str long peek() {
			return arr[tail];
		} peek {
			return arr[tail];
		} return arr[tail]; arr[tail] arr tail public class Main {

	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		MyStack stack = new MyStack();

		while(in.hasNext()) {
			stack.push(in.next());
		}

		System.out.println(stack.peek());
	}

	static class MyStack{
		long[] arr;
		int tail;

		MyStack() {
			arr = new long[100];
			tail = -1;
		}

		void push(String str) {

			try {
				long v = Long.parseLong(str);
				//System.out.println("insert" + v);
                arr[++tail] = v;
                //System.out.println("tail" + tail);
			}catch(Exception e) {
                //System.out.println("calc operetion requested");
				char op = str.charAt(0);

				switch(op) {
					case '+': 
						long eq1 = arr[tail - 1] + arr[tail];
                        arr[tail - 1] = eq1;
                        tail--;
						break;

					case '-':
						long eq2 = arr[tail - 1] - arr[tail];
						arr[--tail] = eq2;
						break;

					case '*':
						long eq3 = arr[tail - 1] * arr[tail];
						arr[--tail] = eq3;
						break;
				}
			}
		}

		long peek() {
			return arr[tail];
		}
	}

} public class Main {

	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		MyStack stack = new MyStack();

		while(in.hasNext()) {
			stack.push(in.next());
		}

		System.out.println(stack.peek());
	}

	static class MyStack{
		long[] arr;
		int tail;

		MyStack() {
			arr = new long[100];
			tail = -1;
		}

		void push(String str) {

			try {
				long v = Long.parseLong(str);
				//System.out.println("insert" + v);
                arr[++tail] = v;
                //System.out.println("tail" + tail);
			}catch(Exception e) {
                //System.out.println("calc operetion requested");
				char op = str.charAt(0);

				switch(op) {
					case '+': 
						long eq1 = arr[tail - 1] + arr[tail];
                        arr[tail - 1] = eq1;
                        tail--;
						break;

					case '-':
						long eq2 = arr[tail - 1] - arr[tail];
						arr[--tail] = eq2;
						break;

					case '*':
						long eq3 = arr[tail - 1] * arr[tail];
						arr[--tail] = eq3;
						break;
				}
			}
		}

		long peek() {
			return arr[tail];
		}
	}

} Main
import java.util.*;

public class Main {

	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		MyStack stack = new MyStack();

		while(in.hasNext()) {
			stack.push(in.next());
		}

		System.out.println(stack.peek());
	}

	static class MyStack{
		long[] arr;
		int tail;

		MyStack() {
			arr = new long[100];
			tail = -1;
		}

		void push(String str) {

			try {
				long v = Long.parseLong(str);
				//System.out.println("insert" + v);
                arr[++tail] = v;
                //System.out.println("tail" + tail);
			}catch(Exception e) {
                //System.out.println("calc operetion requested");
				char op = str.charAt(0);

				switch(op) {
					case '+': 
						long eq1 = arr[tail - 1] + arr[tail];
                        arr[tail - 1] = eq1;
                        tail--;
						break;

					case '-':
						long eq2 = arr[tail - 1] - arr[tail];
						arr[--tail] = eq2;
						break;

					case '*':
						long eq3 = arr[tail - 1] * arr[tail];
						arr[--tail] = eq3;
						break;
				}
			}
		}

		long peek() {
			return arr[tail];
		}
	}

}

