/*
 * http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=ALDS1_3_A&lang=jp
 */
import java.util.*;

public class Main {
	void run() {
		Scanner scan = new Scanner(System.in);
		int[] stack = new int[200];
		int sp = 0;
		while (scan.hasNext()) {
			String tok = scan.next();
			if (tok.equals("+")) {
				int b = stack[--sp];
				int a = stack[--sp];
				stack[sp++] = a + b;
			} else if (tok.equals("-")) {
				int b = stack[--sp];
				int a = stack[--sp];
				stack[sp++] = a - b;
			} else if (tok.equals("*")) {
				int b = stack[--sp];
				int a = stack[--sp];
				stack[sp++] = a * b;
			} else {
				int x = Integer.parseInt(tok);
				stack[sp++] = x;
			}
			//System.out.println(sp);
		}
		System.out.println(stack[0]);
	}
	public static void main(String[] args) {
		new Main().run();
	}
}
 import java.util.*; util.* java public class Main {
	void run() {
		Scanner scan = new Scanner(System.in);
		int[] stack = new int[200];
		int sp = 0;
		while (scan.hasNext()) {
			String tok = scan.next();
			if (tok.equals("+")) {
				int b = stack[--sp];
				int a = stack[--sp];
				stack[sp++] = a + b;
			} else if (tok.equals("-")) {
				int b = stack[--sp];
				int a = stack[--sp];
				stack[sp++] = a - b;
			} else if (tok.equals("*")) {
				int b = stack[--sp];
				int a = stack[--sp];
				stack[sp++] = a * b;
			} else {
				int x = Integer.parseInt(tok);
				stack[sp++] = x;
			}
			//System.out.println(sp);
		}
		System.out.println(stack[0]);
	}
	public static void main(String[] args) {
		new Main().run();
	}
} Main void run() {
		Scanner scan = new Scanner(System.in);
		int[] stack = new int[200];
		int sp = 0;
		while (scan.hasNext()) {
			String tok = scan.next();
			if (tok.equals("+")) {
				int b = stack[--sp];
				int a = stack[--sp];
				stack[sp++] = a + b;
			} else if (tok.equals("-")) {
				int b = stack[--sp];
				int a = stack[--sp];
				stack[sp++] = a - b;
			} else if (tok.equals("*")) {
				int b = stack[--sp];
				int a = stack[--sp];
				stack[sp++] = a * b;
			} else {
				int x = Integer.parseInt(tok);
				stack[sp++] = x;
			}
			//System.out.println(sp);
		}
		System.out.println(stack[0]);
	} run {
		Scanner scan = new Scanner(System.in);
		int[] stack = new int[200];
		int sp = 0;
		while (scan.hasNext()) {
			String tok = scan.next();
			if (tok.equals("+")) {
				int b = stack[--sp];
				int a = stack[--sp];
				stack[sp++] = a + b;
			} else if (tok.equals("-")) {
				int b = stack[--sp];
				int a = stack[--sp];
				stack[sp++] = a - b;
			} else if (tok.equals("*")) {
				int b = stack[--sp];
				int a = stack[--sp];
				stack[sp++] = a * b;
			} else {
				int x = Integer.parseInt(tok);
				stack[sp++] = x;
			}
			//System.out.println(sp);
		}
		System.out.println(stack[0]);
	} Scanner scan = new Scanner(System.in); scan new Scanner(System.in) int[] stack = new int[200]; stack new int[200] 200 int sp = 0; sp 0 while (scan.hasNext()) {
			String tok = scan.next();
			if (tok.equals("+")) {
				int b = stack[--sp];
				int a = stack[--sp];
				stack[sp++] = a + b;
			} else if (tok.equals("-")) {
				int b = stack[--sp];
				int a = stack[--sp];
				stack[sp++] = a - b;
			} else if (tok.equals("*")) {
				int b = stack[--sp];
				int a = stack[--sp];
				stack[sp++] = a * b;
			} else {
				int x = Integer.parseInt(tok);
				stack[sp++] = x;
			}
			//System.out.println(sp);
		} scan.hasNext() scan.hasNext scan {
			String tok = scan.next();
			if (tok.equals("+")) {
				int b = stack[--sp];
				int a = stack[--sp];
				stack[sp++] = a + b;
			} else if (tok.equals("-")) {
				int b = stack[--sp];
				int a = stack[--sp];
				stack[sp++] = a - b;
			} else if (tok.equals("*")) {
				int b = stack[--sp];
				int a = stack[--sp];
				stack[sp++] = a * b;
			} else {
				int x = Integer.parseInt(tok);
				stack[sp++] = x;
			}
			//System.out.println(sp);
		} String tok = scan.next(); tok scan.next() scan.next scan if (tok.equals("+")) {
				int b = stack[--sp];
				int a = stack[--sp];
				stack[sp++] = a + b;
			} else if (tok.equals("-")) {
				int b = stack[--sp];
				int a = stack[--sp];
				stack[sp++] = a - b;
			} else if (tok.equals("*")) {
				int b = stack[--sp];
				int a = stack[--sp];
				stack[sp++] = a * b;
			} else {
				int x = Integer.parseInt(tok);
				stack[sp++] = x;
			} tok.equals("+") tok.equals tok "+" {
				int b = stack[--sp];
				int a = stack[--sp];
				stack[sp++] = a + b;
			} int b = stack[--sp]; b stack[--sp] stack --sp sp int a = stack[--sp]; a stack[--sp] stack --sp sp stack[sp++] = a + b stack[sp++] stack sp++ sp a + b a b if (tok.equals("-")) {
				int b = stack[--sp];
				int a = stack[--sp];
				stack[sp++] = a - b;
			} else if (tok.equals("*")) {
				int b = stack[--sp];
				int a = stack[--sp];
				stack[sp++] = a * b;
			} else {
				int x = Integer.parseInt(tok);
				stack[sp++] = x;
			} tok.equals("-") tok.equals tok "-" {
				int b = stack[--sp];
				int a = stack[--sp];
				stack[sp++] = a - b;
			} int b = stack[--sp]; b stack[--sp] stack --sp sp int a = stack[--sp]; a stack[--sp] stack --sp sp stack[sp++] = a - b stack[sp++] stack sp++ sp a - b a b if (tok.equals("*")) {
				int b = stack[--sp];
				int a = stack[--sp];
				stack[sp++] = a * b;
			} else {
				int x = Integer.parseInt(tok);
				stack[sp++] = x;
			} tok.equals("*") tok.equals tok "*" {
				int b = stack[--sp];
				int a = stack[--sp];
				stack[sp++] = a * b;
			} int b = stack[--sp]; b stack[--sp] stack --sp sp int a = stack[--sp]; a stack[--sp] stack --sp sp stack[sp++] = a * b stack[sp++] stack sp++ sp a * b a b {
				int x = Integer.parseInt(tok);
				stack[sp++] = x;
			} int x = Integer.parseInt(tok); x Integer.parseInt(tok) Integer.parseInt Integer tok stack[sp++] = x stack[sp++] stack sp++ sp x System.out.println(stack[0]) System.out.println System.out System System.out stack[0] stack 0 public static void main(String[] args) {
		new Main().run();
	} main {
		new Main().run();
	} new Main().run() new Main().run new Main() String[] args args public class Main {
	void run() {
		Scanner scan = new Scanner(System.in);
		int[] stack = new int[200];
		int sp = 0;
		while (scan.hasNext()) {
			String tok = scan.next();
			if (tok.equals("+")) {
				int b = stack[--sp];
				int a = stack[--sp];
				stack[sp++] = a + b;
			} else if (tok.equals("-")) {
				int b = stack[--sp];
				int a = stack[--sp];
				stack[sp++] = a - b;
			} else if (tok.equals("*")) {
				int b = stack[--sp];
				int a = stack[--sp];
				stack[sp++] = a * b;
			} else {
				int x = Integer.parseInt(tok);
				stack[sp++] = x;
			}
			//System.out.println(sp);
		}
		System.out.println(stack[0]);
	}
	public static void main(String[] args) {
		new Main().run();
	}
} public class Main {
	void run() {
		Scanner scan = new Scanner(System.in);
		int[] stack = new int[200];
		int sp = 0;
		while (scan.hasNext()) {
			String tok = scan.next();
			if (tok.equals("+")) {
				int b = stack[--sp];
				int a = stack[--sp];
				stack[sp++] = a + b;
			} else if (tok.equals("-")) {
				int b = stack[--sp];
				int a = stack[--sp];
				stack[sp++] = a - b;
			} else if (tok.equals("*")) {
				int b = stack[--sp];
				int a = stack[--sp];
				stack[sp++] = a * b;
			} else {
				int x = Integer.parseInt(tok);
				stack[sp++] = x;
			}
			//System.out.println(sp);
		}
		System.out.println(stack[0]);
	}
	public static void main(String[] args) {
		new Main().run();
	}
} Main
/*
 * http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=ALDS1_3_A&lang=jp
 */
import java.util.*;

public class Main {
	void run() {
		Scanner scan = new Scanner(System.in);
		int[] stack = new int[200];
		int sp = 0;
		while (scan.hasNext()) {
			String tok = scan.next();
			if (tok.equals("+")) {
				int b = stack[--sp];
				int a = stack[--sp];
				stack[sp++] = a + b;
			} else if (tok.equals("-")) {
				int b = stack[--sp];
				int a = stack[--sp];
				stack[sp++] = a - b;
			} else if (tok.equals("*")) {
				int b = stack[--sp];
				int a = stack[--sp];
				stack[sp++] = a * b;
			} else {
				int x = Integer.parseInt(tok);
				stack[sp++] = x;
			}
			//System.out.println(sp);
		}
		System.out.println(stack[0]);
	}
	public static void main(String[] args) {
		new Main().run();
	}
}

