import java.util.Deque;
import java.util.LinkedList;
import java.util.Scanner;

public class Main{

	public static void main(String args[]){
		new Main().mainrun();
	}

	private Scanner scan;
	private Deque<String> d;
	private String str;

	private void mainrun() {
		scan = new Scanner(System.in);

		d = new LinkedList<>();

		while(scan.hasNext()) {
			str = scan.next();

			switch(str) {
			case "+":
			case "-":
			case "*":
				d.push(Calculation(Long.parseLong(d.pop()),
								   Long.parseLong(d.pop()),
								   str).toString());
				break;

			default:
				d.push(str);
			}
		}

		System.out.println(d.pop());
		scan.close();
	}

	private Long Calculation(long x,long y,String c) {
		switch(c) {
		case "+":
			return y + x;
		case "-":
			return y - x;
		case "*":
			return y * x;
		}
		return (long) 0;
	}
}
 import java.util.Deque; Deque java.util import java.util.LinkedList; LinkedList java.util import java.util.Scanner; Scanner java.util public class Main{

	public static void main(String args[]){
		new Main().mainrun();
	}

	private Scanner scan;
	private Deque<String> d;
	private String str;

	private void mainrun() {
		scan = new Scanner(System.in);

		d = new LinkedList<>();

		while(scan.hasNext()) {
			str = scan.next();

			switch(str) {
			case "+":
			case "-":
			case "*":
				d.push(Calculation(Long.parseLong(d.pop()),
								   Long.parseLong(d.pop()),
								   str).toString());
				break;

			default:
				d.push(str);
			}
		}

		System.out.println(d.pop());
		scan.close();
	}

	private Long Calculation(long x,long y,String c) {
		switch(c) {
		case "+":
			return y + x;
		case "-":
			return y - x;
		case "*":
			return y * x;
		}
		return (long) 0;
	}
} Main private Scanner scan; scan private Deque<String> d; d private String str; str public static void main(String args[]){
		new Main().mainrun();
	} main {
		new Main().mainrun();
	} new Main().mainrun() new Main().mainrun new Main() String args[] args private void mainrun() {
		scan = new Scanner(System.in);

		d = new LinkedList<>();

		while(scan.hasNext()) {
			str = scan.next();

			switch(str) {
			case "+":
			case "-":
			case "*":
				d.push(Calculation(Long.parseLong(d.pop()),
								   Long.parseLong(d.pop()),
								   str).toString());
				break;

			default:
				d.push(str);
			}
		}

		System.out.println(d.pop());
		scan.close();
	} mainrun {
		scan = new Scanner(System.in);

		d = new LinkedList<>();

		while(scan.hasNext()) {
			str = scan.next();

			switch(str) {
			case "+":
			case "-":
			case "*":
				d.push(Calculation(Long.parseLong(d.pop()),
								   Long.parseLong(d.pop()),
								   str).toString());
				break;

			default:
				d.push(str);
			}
		}

		System.out.println(d.pop());
		scan.close();
	} scan = new Scanner(System.in) scan new Scanner(System.in) d = new LinkedList<>() d new LinkedList<>() while(scan.hasNext()) {
			str = scan.next();

			switch(str) {
			case "+":
			case "-":
			case "*":
				d.push(Calculation(Long.parseLong(d.pop()),
								   Long.parseLong(d.pop()),
								   str).toString());
				break;

			default:
				d.push(str);
			}
		} scan.hasNext() scan.hasNext scan {
			str = scan.next();

			switch(str) {
			case "+":
			case "-":
			case "*":
				d.push(Calculation(Long.parseLong(d.pop()),
								   Long.parseLong(d.pop()),
								   str).toString());
				break;

			default:
				d.push(str);
			}
		} str = scan.next() str scan.next() scan.next scan switch(str) {
			case "+":
			case "-":
			case "*":
				d.push(Calculation(Long.parseLong(d.pop()),
								   Long.parseLong(d.pop()),
								   str).toString());
				break;

			default:
				d.push(str);
			} str case "+": "+" case "+": case "-": "-" case "-": case "*": "*" case "*": d.push(Calculation(Long.parseLong(d.pop()),
								   Long.parseLong(d.pop()),
								   str).toString()) d.push d Calculation(Long.parseLong(d.pop()),
								   Long.parseLong(d.pop()),
								   str).toString() Calculation(Long.parseLong(d.pop()),
								   Long.parseLong(d.pop()),
								   str).toString Calculation(Long.parseLong(d.pop()),
								   Long.parseLong(d.pop()),
								   str) Calculation Long.parseLong(d.pop()) Long.parseLong Long d.pop() d.pop d Long.parseLong(d.pop()) Long.parseLong Long d.pop() d.pop d str break; default: default: d.push(str) d.push d str System.out.println(d.pop()) System.out.println System.out System System.out d.pop() d.pop d scan.close() scan.close scan private Long Calculation(long x,long y,String c) {
		switch(c) {
		case "+":
			return y + x;
		case "-":
			return y - x;
		case "*":
			return y * x;
		}
		return (long) 0;
	} Calculation {
		switch(c) {
		case "+":
			return y + x;
		case "-":
			return y - x;
		case "*":
			return y * x;
		}
		return (long) 0;
	} switch(c) {
		case "+":
			return y + x;
		case "-":
			return y - x;
		case "*":
			return y * x;
		} c case "+": "+" case "+": return y + x; y + x y x case "-": "-" case "-": return y - x; y - x y x case "*": "*" case "*": return y * x; y * x y x return (long) 0; (long) 0 long x x long y y String c c public class Main{

	public static void main(String args[]){
		new Main().mainrun();
	}

	private Scanner scan;
	private Deque<String> d;
	private String str;

	private void mainrun() {
		scan = new Scanner(System.in);

		d = new LinkedList<>();

		while(scan.hasNext()) {
			str = scan.next();

			switch(str) {
			case "+":
			case "-":
			case "*":
				d.push(Calculation(Long.parseLong(d.pop()),
								   Long.parseLong(d.pop()),
								   str).toString());
				break;

			default:
				d.push(str);
			}
		}

		System.out.println(d.pop());
		scan.close();
	}

	private Long Calculation(long x,long y,String c) {
		switch(c) {
		case "+":
			return y + x;
		case "-":
			return y - x;
		case "*":
			return y * x;
		}
		return (long) 0;
	}
} public class Main{

	public static void main(String args[]){
		new Main().mainrun();
	}

	private Scanner scan;
	private Deque<String> d;
	private String str;

	private void mainrun() {
		scan = new Scanner(System.in);

		d = new LinkedList<>();

		while(scan.hasNext()) {
			str = scan.next();

			switch(str) {
			case "+":
			case "-":
			case "*":
				d.push(Calculation(Long.parseLong(d.pop()),
								   Long.parseLong(d.pop()),
								   str).toString());
				break;

			default:
				d.push(str);
			}
		}

		System.out.println(d.pop());
		scan.close();
	}

	private Long Calculation(long x,long y,String c) {
		switch(c) {
		case "+":
			return y + x;
		case "-":
			return y - x;
		case "*":
			return y * x;
		}
		return (long) 0;
	}
} Main
import java.util.Deque;
import java.util.LinkedList;
import java.util.Scanner;

public class Main{

	public static void main(String args[]){
		new Main().mainrun();
	}

	private Scanner scan;
	private Deque<String> d;
	private String str;

	private void mainrun() {
		scan = new Scanner(System.in);

		d = new LinkedList<>();

		while(scan.hasNext()) {
			str = scan.next();

			switch(str) {
			case "+":
			case "-":
			case "*":
				d.push(Calculation(Long.parseLong(d.pop()),
								   Long.parseLong(d.pop()),
								   str).toString());
				break;

			default:
				d.push(str);
			}
		}

		System.out.println(d.pop());
		scan.close();
	}

	private Long Calculation(long x,long y,String c) {
		switch(c) {
		case "+":
			return y + x;
		case "-":
			return y - x;
		case "*":
			return y * x;
		}
		return (long) 0;
	}
}

