import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {

	public static final int BIG_NUM = 2000000000;
	public static final int MOD = 1000000007;

	public static void main(String[] args) {

		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		final int SIZE = 105;

		Stack stack = new Stack(SIZE);
		int num_1 = 0,num_2 = 0;

		try {

			String input_str[] = br.readLine().split("\\s+");
			for(int i = 0; i < input_str.length; i++){
				switch(input_str[i]){
				case "+":

					num_2 = stack.pop_NUM();
					num_1 = stack.pop_NUM();
					stack.push_NUM(num_1+num_2);
					break;

				case "-":

					num_2 = stack.pop_NUM();
					num_1 = stack.pop_NUM();
					stack.push_NUM(num_1-num_2);
					break;

				case "*":

					num_2 = stack.pop_NUM();
					num_1 = stack.pop_NUM();
					stack.push_NUM(num_1*num_2);
					break;

				default:

					stack.push_NUM(Integer.parseInt(input_str[i]));
					break;
				}
			}

			System.out.println(stack.pop_NUM());

		} catch (IOException e) {
			// TODO 自動生成された catch ブロック
			e.printStackTrace();
		}



	}
}

class Stack{

	private int NUM[];
	private int index_NUM;

	Stack(int arg_size){
		NUM = new int[arg_size];
		index_NUM = 0;
	}
	public void push_NUM(int num){

		NUM[index_NUM++] = num;
	}
	public int pop_NUM(){
		index_NUM--;
		return NUM[index_NUM];
	}

	public boolean is_Empty(){

		return index_NUM == 0;
	}
} import java.io.BufferedReader; BufferedReader java.io import java.io.IOException; IOException java.io import java.io.InputStreamReader; InputStreamReader java.io public class Main {

	public static final int BIG_NUM = 2000000000;
	public static final int MOD = 1000000007;

	public static void main(String[] args) {

		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		final int SIZE = 105;

		Stack stack = new Stack(SIZE);
		int num_1 = 0,num_2 = 0;

		try {

			String input_str[] = br.readLine().split("\\s+");
			for(int i = 0; i < input_str.length; i++){
				switch(input_str[i]){
				case "+":

					num_2 = stack.pop_NUM();
					num_1 = stack.pop_NUM();
					stack.push_NUM(num_1+num_2);
					break;

				case "-":

					num_2 = stack.pop_NUM();
					num_1 = stack.pop_NUM();
					stack.push_NUM(num_1-num_2);
					break;

				case "*":

					num_2 = stack.pop_NUM();
					num_1 = stack.pop_NUM();
					stack.push_NUM(num_1*num_2);
					break;

				default:

					stack.push_NUM(Integer.parseInt(input_str[i]));
					break;
				}
			}

			System.out.println(stack.pop_NUM());

		} catch (IOException e) {
			// TODO 自動生成された catch ブロック
			e.printStackTrace();
		}



	}
} Main public static final int BIG_NUM = 2000000000; BIG_NUM 2000000000 public static final int MOD = 1000000007; MOD 1000000007 public static void main(String[] args) {

		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		final int SIZE = 105;

		Stack stack = new Stack(SIZE);
		int num_1 = 0,num_2 = 0;

		try {

			String input_str[] = br.readLine().split("\\s+");
			for(int i = 0; i < input_str.length; i++){
				switch(input_str[i]){
				case "+":

					num_2 = stack.pop_NUM();
					num_1 = stack.pop_NUM();
					stack.push_NUM(num_1+num_2);
					break;

				case "-":

					num_2 = stack.pop_NUM();
					num_1 = stack.pop_NUM();
					stack.push_NUM(num_1-num_2);
					break;

				case "*":

					num_2 = stack.pop_NUM();
					num_1 = stack.pop_NUM();
					stack.push_NUM(num_1*num_2);
					break;

				default:

					stack.push_NUM(Integer.parseInt(input_str[i]));
					break;
				}
			}

			System.out.println(stack.pop_NUM());

		} catch (IOException e) {
			// TODO 自動生成された catch ブロック
			e.printStackTrace();
		}



	} main {

		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		final int SIZE = 105;

		Stack stack = new Stack(SIZE);
		int num_1 = 0,num_2 = 0;

		try {

			String input_str[] = br.readLine().split("\\s+");
			for(int i = 0; i < input_str.length; i++){
				switch(input_str[i]){
				case "+":

					num_2 = stack.pop_NUM();
					num_1 = stack.pop_NUM();
					stack.push_NUM(num_1+num_2);
					break;

				case "-":

					num_2 = stack.pop_NUM();
					num_1 = stack.pop_NUM();
					stack.push_NUM(num_1-num_2);
					break;

				case "*":

					num_2 = stack.pop_NUM();
					num_1 = stack.pop_NUM();
					stack.push_NUM(num_1*num_2);
					break;

				default:

					stack.push_NUM(Integer.parseInt(input_str[i]));
					break;
				}
			}

			System.out.println(stack.pop_NUM());

		} catch (IOException e) {
			// TODO 自動生成された catch ブロック
			e.printStackTrace();
		}



	} BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); br new BufferedReader(new InputStreamReader(System.in)) final int SIZE = 105; SIZE 105 Stack stack = new Stack(SIZE); stack new Stack(SIZE) int num_1 = 0 num_1 0 num_2 = 0; num_2 0 try {

			String input_str[] = br.readLine().split("\\s+");
			for(int i = 0; i < input_str.length; i++){
				switch(input_str[i]){
				case "+":

					num_2 = stack.pop_NUM();
					num_1 = stack.pop_NUM();
					stack.push_NUM(num_1+num_2);
					break;

				case "-":

					num_2 = stack.pop_NUM();
					num_1 = stack.pop_NUM();
					stack.push_NUM(num_1-num_2);
					break;

				case "*":

					num_2 = stack.pop_NUM();
					num_1 = stack.pop_NUM();
					stack.push_NUM(num_1*num_2);
					break;

				default:

					stack.push_NUM(Integer.parseInt(input_str[i]));
					break;
				}
			}

			System.out.println(stack.pop_NUM());

		} catch (IOException e) {
			// TODO 自動生成された catch ブロック
			e.printStackTrace();
		} catch (IOException e) {
			// TODO 自動生成された catch ブロック
			e.printStackTrace();
		} IOException e {
			// TODO 自動生成された catch ブロック
			e.printStackTrace();
		} e.printStackTrace() e.printStackTrace e {

			String input_str[] = br.readLine().split("\\s+");
			for(int i = 0; i < input_str.length; i++){
				switch(input_str[i]){
				case "+":

					num_2 = stack.pop_NUM();
					num_1 = stack.pop_NUM();
					stack.push_NUM(num_1+num_2);
					break;

				case "-":

					num_2 = stack.pop_NUM();
					num_1 = stack.pop_NUM();
					stack.push_NUM(num_1-num_2);
					break;

				case "*":

					num_2 = stack.pop_NUM();
					num_1 = stack.pop_NUM();
					stack.push_NUM(num_1*num_2);
					break;

				default:

					stack.push_NUM(Integer.parseInt(input_str[i]));
					break;
				}
			}

			System.out.println(stack.pop_NUM());

		} String input_str[] = br.readLine().split("\\s+"); input_str br.readLine().split("\\s+") br.readLine().split br.readLine() br.readLine br "\\s+" for(int i = 0; i < input_str.length; i++){
				switch(input_str[i]){
				case "+":

					num_2 = stack.pop_NUM();
					num_1 = stack.pop_NUM();
					stack.push_NUM(num_1+num_2);
					break;

				case "-":

					num_2 = stack.pop_NUM();
					num_1 = stack.pop_NUM();
					stack.push_NUM(num_1-num_2);
					break;

				case "*":

					num_2 = stack.pop_NUM();
					num_1 = stack.pop_NUM();
					stack.push_NUM(num_1*num_2);
					break;

				default:

					stack.push_NUM(Integer.parseInt(input_str[i]));
					break;
				}
			} int i = 0; int i = 0; i 0 i < input_str.length i input_str.length input_str input_str.length i++ i++ i {
				switch(input_str[i]){
				case "+":

					num_2 = stack.pop_NUM();
					num_1 = stack.pop_NUM();
					stack.push_NUM(num_1+num_2);
					break;

				case "-":

					num_2 = stack.pop_NUM();
					num_1 = stack.pop_NUM();
					stack.push_NUM(num_1-num_2);
					break;

				case "*":

					num_2 = stack.pop_NUM();
					num_1 = stack.pop_NUM();
					stack.push_NUM(num_1*num_2);
					break;

				default:

					stack.push_NUM(Integer.parseInt(input_str[i]));
					break;
				}
			} {
				switch(input_str[i]){
				case "+":

					num_2 = stack.pop_NUM();
					num_1 = stack.pop_NUM();
					stack.push_NUM(num_1+num_2);
					break;

				case "-":

					num_2 = stack.pop_NUM();
					num_1 = stack.pop_NUM();
					stack.push_NUM(num_1-num_2);
					break;

				case "*":

					num_2 = stack.pop_NUM();
					num_1 = stack.pop_NUM();
					stack.push_NUM(num_1*num_2);
					break;

				default:

					stack.push_NUM(Integer.parseInt(input_str[i]));
					break;
				}
			} switch(input_str[i]){
				case "+":

					num_2 = stack.pop_NUM();
					num_1 = stack.pop_NUM();
					stack.push_NUM(num_1+num_2);
					break;

				case "-":

					num_2 = stack.pop_NUM();
					num_1 = stack.pop_NUM();
					stack.push_NUM(num_1-num_2);
					break;

				case "*":

					num_2 = stack.pop_NUM();
					num_1 = stack.pop_NUM();
					stack.push_NUM(num_1*num_2);
					break;

				default:

					stack.push_NUM(Integer.parseInt(input_str[i]));
					break;
				} input_str[i] input_str i case "+": "+" case "+": num_2 = stack.pop_NUM() num_2 stack.pop_NUM() stack.pop_NUM stack num_1 = stack.pop_NUM() num_1 stack.pop_NUM() stack.pop_NUM stack stack.push_NUM(num_1+num_2) stack.push_NUM stack num_1+num_2 num_1 num_2 break; case "-": "-" case "-": num_2 = stack.pop_NUM() num_2 stack.pop_NUM() stack.pop_NUM stack num_1 = stack.pop_NUM() num_1 stack.pop_NUM() stack.pop_NUM stack stack.push_NUM(num_1-num_2) stack.push_NUM stack num_1-num_2 num_1 num_2 break; case "*": "*" case "*": num_2 = stack.pop_NUM() num_2 stack.pop_NUM() stack.pop_NUM stack num_1 = stack.pop_NUM() num_1 stack.pop_NUM() stack.pop_NUM stack stack.push_NUM(num_1*num_2) stack.push_NUM stack num_1*num_2 num_1 num_2 break; default: default: stack.push_NUM(Integer.parseInt(input_str[i])) stack.push_NUM stack Integer.parseInt(input_str[i]) Integer.parseInt Integer input_str[i] input_str i break; System.out.println(stack.pop_NUM()) System.out.println System.out System System.out stack.pop_NUM() stack.pop_NUM stack String[] args args class Stack{

	private int NUM[];
	private int index_NUM;

	Stack(int arg_size){
		NUM = new int[arg_size];
		index_NUM = 0;
	}
	public void push_NUM(int num){

		NUM[index_NUM++] = num;
	}
	public int pop_NUM(){
		index_NUM--;
		return NUM[index_NUM];
	}

	public boolean is_Empty(){

		return index_NUM == 0;
	}
} Stack private int NUM[]; NUM private int index_NUM; index_NUM Stack(int arg_size){
		NUM = new int[arg_size];
		index_NUM = 0;
	} Stack {
		NUM = new int[arg_size];
		index_NUM = 0;
	} NUM = new int[arg_size] NUM new int[arg_size] arg_size index_NUM = 0 index_NUM 0 int arg_size arg_size public void push_NUM(int num){

		NUM[index_NUM++] = num;
	} push_NUM {

		NUM[index_NUM++] = num;
	} NUM[index_NUM++] = num NUM[index_NUM++] NUM index_NUM++ index_NUM num int num num public int pop_NUM(){
		index_NUM--;
		return NUM[index_NUM];
	} pop_NUM {
		index_NUM--;
		return NUM[index_NUM];
	} index_NUM-- index_NUM return NUM[index_NUM]; NUM[index_NUM] NUM index_NUM public boolean is_Empty(){

		return index_NUM == 0;
	} is_Empty {

		return index_NUM == 0;
	} return index_NUM == 0; index_NUM == 0 index_NUM 0 public class Main {

	public static final int BIG_NUM = 2000000000;
	public static final int MOD = 1000000007;

	public static void main(String[] args) {

		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		final int SIZE = 105;

		Stack stack = new Stack(SIZE);
		int num_1 = 0,num_2 = 0;

		try {

			String input_str[] = br.readLine().split("\\s+");
			for(int i = 0; i < input_str.length; i++){
				switch(input_str[i]){
				case "+":

					num_2 = stack.pop_NUM();
					num_1 = stack.pop_NUM();
					stack.push_NUM(num_1+num_2);
					break;

				case "-":

					num_2 = stack.pop_NUM();
					num_1 = stack.pop_NUM();
					stack.push_NUM(num_1-num_2);
					break;

				case "*":

					num_2 = stack.pop_NUM();
					num_1 = stack.pop_NUM();
					stack.push_NUM(num_1*num_2);
					break;

				default:

					stack.push_NUM(Integer.parseInt(input_str[i]));
					break;
				}
			}

			System.out.println(stack.pop_NUM());

		} catch (IOException e) {
			// TODO 自動生成された catch ブロック
			e.printStackTrace();
		}



	}
} public class Main {

	public static final int BIG_NUM = 2000000000;
	public static final int MOD = 1000000007;

	public static void main(String[] args) {

		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		final int SIZE = 105;

		Stack stack = new Stack(SIZE);
		int num_1 = 0,num_2 = 0;

		try {

			String input_str[] = br.readLine().split("\\s+");
			for(int i = 0; i < input_str.length; i++){
				switch(input_str[i]){
				case "+":

					num_2 = stack.pop_NUM();
					num_1 = stack.pop_NUM();
					stack.push_NUM(num_1+num_2);
					break;

				case "-":

					num_2 = stack.pop_NUM();
					num_1 = stack.pop_NUM();
					stack.push_NUM(num_1-num_2);
					break;

				case "*":

					num_2 = stack.pop_NUM();
					num_1 = stack.pop_NUM();
					stack.push_NUM(num_1*num_2);
					break;

				default:

					stack.push_NUM(Integer.parseInt(input_str[i]));
					break;
				}
			}

			System.out.println(stack.pop_NUM());

		} catch (IOException e) {
			// TODO 自動生成された catch ブロック
			e.printStackTrace();
		}



	}
} Main
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {

	public static final int BIG_NUM = 2000000000;
	public static final int MOD = 1000000007;

	public static void main(String[] args) {

		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		final int SIZE = 105;

		Stack stack = new Stack(SIZE);
		int num_1 = 0,num_2 = 0;

		try {

			String input_str[] = br.readLine().split("\\s+");
			for(int i = 0; i < input_str.length; i++){
				switch(input_str[i]){
				case "+":

					num_2 = stack.pop_NUM();
					num_1 = stack.pop_NUM();
					stack.push_NUM(num_1+num_2);
					break;

				case "-":

					num_2 = stack.pop_NUM();
					num_1 = stack.pop_NUM();
					stack.push_NUM(num_1-num_2);
					break;

				case "*":

					num_2 = stack.pop_NUM();
					num_1 = stack.pop_NUM();
					stack.push_NUM(num_1*num_2);
					break;

				default:

					stack.push_NUM(Integer.parseInt(input_str[i]));
					break;
				}
			}

			System.out.println(stack.pop_NUM());

		} catch (IOException e) {
			// TODO 自動生成された catch ブロック
			e.printStackTrace();
		}



	}
}

class Stack{

	private int NUM[];
	private int index_NUM;

	Stack(int arg_size){
		NUM = new int[arg_size];
		index_NUM = 0;
	}
	public void push_NUM(int num){

		NUM[index_NUM++] = num;
	}
	public int pop_NUM(){
		index_NUM--;
		return NUM[index_NUM];
	}

	public boolean is_Empty(){

		return index_NUM == 0;
	}
}
