import java.io.File;
import java.io.FileNotFoundException;
import java.lang.management.ManagementFactory;
import java.lang.management.ThreadMXBean;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.List;
import java.util.PriorityQueue;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) throws FileNotFoundException {

		Scanner scan = new Scanner(System.in);
		// Scanner scan = new Scanner(new
		// File("D:\\UserArea\\J0124567\\Downloads\\2010-input.txt"));

		while (scan.hasNext()) {

			String s = scan.next();
			Do(s);
		}
		System.out.println(stk[0]);

		scan.close();
		System.exit(0);
	}

	static int[] stk = new int[101];
	static int pt = -1;

	private static void Do(String s) {
		switch (s) {
		case ("+"):
			stk[pt - 1] += stk[pt];
			pt--;
			break;
		case ("-"):
			stk[pt - 1] -= stk[pt];
			pt--;
			break;
		case ("*"):
			stk[pt - 1] *= stk[pt];
			pt--;
			break;
		default:
			pt++;
			stk[pt] = Integer.valueOf(s);
		}

	}

} import java.io.File; File java.io import java.io.FileNotFoundException; FileNotFoundException java.io import java.lang.management.ManagementFactory; ManagementFactory java.lang.management import java.lang.management.ThreadMXBean; ThreadMXBean java.lang.management import java.util.ArrayList; ArrayList java.util import java.util.Collections; Collections java.util import java.util.Comparator; Comparator java.util import java.util.List; List java.util import java.util.PriorityQueue; PriorityQueue java.util import java.util.Scanner; Scanner java.util public class Main {

	public static void main(String[] args) throws FileNotFoundException {

		Scanner scan = new Scanner(System.in);
		// Scanner scan = new Scanner(new
		// File("D:\\UserArea\\J0124567\\Downloads\\2010-input.txt"));

		while (scan.hasNext()) {

			String s = scan.next();
			Do(s);
		}
		System.out.println(stk[0]);

		scan.close();
		System.exit(0);
	}

	static int[] stk = new int[101];
	static int pt = -1;

	private static void Do(String s) {
		switch (s) {
		case ("+"):
			stk[pt - 1] += stk[pt];
			pt--;
			break;
		case ("-"):
			stk[pt - 1] -= stk[pt];
			pt--;
			break;
		case ("*"):
			stk[pt - 1] *= stk[pt];
			pt--;
			break;
		default:
			pt++;
			stk[pt] = Integer.valueOf(s);
		}

	}

} Main static int[] stk = new int[101]; stk new int[101] 101 static int pt = -1; pt -1 1 public static void main(String[] args) throws FileNotFoundException {

		Scanner scan = new Scanner(System.in);
		// Scanner scan = new Scanner(new
		// File("D:\\UserArea\\J0124567\\Downloads\\2010-input.txt"));

		while (scan.hasNext()) {

			String s = scan.next();
			Do(s);
		}
		System.out.println(stk[0]);

		scan.close();
		System.exit(0);
	} main {

		Scanner scan = new Scanner(System.in);
		// Scanner scan = new Scanner(new
		// File("D:\\UserArea\\J0124567\\Downloads\\2010-input.txt"));

		while (scan.hasNext()) {

			String s = scan.next();
			Do(s);
		}
		System.out.println(stk[0]);

		scan.close();
		System.exit(0);
	} Scanner scan = new Scanner(System.in); scan new Scanner(System.in) while (scan.hasNext()) {

			String s = scan.next();
			Do(s);
		} scan.hasNext() scan.hasNext scan {

			String s = scan.next();
			Do(s);
		} String s = scan.next(); s scan.next() scan.next scan Do(s) Do s System.out.println(stk[0]) System.out.println System.out System System.out stk[0] stk 0 scan.close() scan.close scan System.exit(0) System.exit System 0 String[] args args private static void Do(String s) {
		switch (s) {
		case ("+"):
			stk[pt - 1] += stk[pt];
			pt--;
			break;
		case ("-"):
			stk[pt - 1] -= stk[pt];
			pt--;
			break;
		case ("*"):
			stk[pt - 1] *= stk[pt];
			pt--;
			break;
		default:
			pt++;
			stk[pt] = Integer.valueOf(s);
		}

	} Do {
		switch (s) {
		case ("+"):
			stk[pt - 1] += stk[pt];
			pt--;
			break;
		case ("-"):
			stk[pt - 1] -= stk[pt];
			pt--;
			break;
		case ("*"):
			stk[pt - 1] *= stk[pt];
			pt--;
			break;
		default:
			pt++;
			stk[pt] = Integer.valueOf(s);
		}

	} switch (s) {
		case ("+"):
			stk[pt - 1] += stk[pt];
			pt--;
			break;
		case ("-"):
			stk[pt - 1] -= stk[pt];
			pt--;
			break;
		case ("*"):
			stk[pt - 1] *= stk[pt];
			pt--;
			break;
		default:
			pt++;
			stk[pt] = Integer.valueOf(s);
		} s case ("+"): ("+") case ("+"): stk[pt - 1] += stk[pt] stk[pt - 1] stk pt - 1 pt 1 stk[pt] stk pt pt-- pt break; case ("-"): ("-") case ("-"): stk[pt - 1] -= stk[pt] stk[pt - 1] stk pt - 1 pt 1 stk[pt] stk pt pt-- pt break; case ("*"): ("*") case ("*"): stk[pt - 1] *= stk[pt] stk[pt - 1] stk pt - 1 pt 1 stk[pt] stk pt pt-- pt break; default: default: pt++ pt stk[pt] = Integer.valueOf(s) stk[pt] stk pt Integer.valueOf(s) Integer.valueOf Integer s String s s public class Main {

	public static void main(String[] args) throws FileNotFoundException {

		Scanner scan = new Scanner(System.in);
		// Scanner scan = new Scanner(new
		// File("D:\\UserArea\\J0124567\\Downloads\\2010-input.txt"));

		while (scan.hasNext()) {

			String s = scan.next();
			Do(s);
		}
		System.out.println(stk[0]);

		scan.close();
		System.exit(0);
	}

	static int[] stk = new int[101];
	static int pt = -1;

	private static void Do(String s) {
		switch (s) {
		case ("+"):
			stk[pt - 1] += stk[pt];
			pt--;
			break;
		case ("-"):
			stk[pt - 1] -= stk[pt];
			pt--;
			break;
		case ("*"):
			stk[pt - 1] *= stk[pt];
			pt--;
			break;
		default:
			pt++;
			stk[pt] = Integer.valueOf(s);
		}

	}

} public class Main {

	public static void main(String[] args) throws FileNotFoundException {

		Scanner scan = new Scanner(System.in);
		// Scanner scan = new Scanner(new
		// File("D:\\UserArea\\J0124567\\Downloads\\2010-input.txt"));

		while (scan.hasNext()) {

			String s = scan.next();
			Do(s);
		}
		System.out.println(stk[0]);

		scan.close();
		System.exit(0);
	}

	static int[] stk = new int[101];
	static int pt = -1;

	private static void Do(String s) {
		switch (s) {
		case ("+"):
			stk[pt - 1] += stk[pt];
			pt--;
			break;
		case ("-"):
			stk[pt - 1] -= stk[pt];
			pt--;
			break;
		case ("*"):
			stk[pt - 1] *= stk[pt];
			pt--;
			break;
		default:
			pt++;
			stk[pt] = Integer.valueOf(s);
		}

	}

} Main
import java.io.File;
import java.io.FileNotFoundException;
import java.lang.management.ManagementFactory;
import java.lang.management.ThreadMXBean;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.List;
import java.util.PriorityQueue;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) throws FileNotFoundException {

		Scanner scan = new Scanner(System.in);
		// Scanner scan = new Scanner(new
		// File("D:\\UserArea\\J0124567\\Downloads\\2010-input.txt"));

		while (scan.hasNext()) {

			String s = scan.next();
			Do(s);
		}
		System.out.println(stk[0]);

		scan.close();
		System.exit(0);
	}

	static int[] stk = new int[101];
	static int pt = -1;

	private static void Do(String s) {
		switch (s) {
		case ("+"):
			stk[pt - 1] += stk[pt];
			pt--;
			break;
		case ("-"):
			stk[pt - 1] -= stk[pt];
			pt--;
			break;
		case ("*"):
			stk[pt - 1] *= stk[pt];
			pt--;
			break;
		default:
			pt++;
			stk[pt] = Integer.valueOf(s);
		}

	}

}