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

public class Main {

	public static void main(String[] args) throws NumberFormatException,
			IOException {
		BufferedReader reader = new BufferedReader(new InputStreamReader(
				System.in));

		String[] strs = reader.readLine().split(" ");
		int[] nums = new int[strs.length];
		int top = 0;
		for (int i = 0; i < strs.length; i++) {
			switch (strs[i].charAt(0)) {
			case '+':
				top--;
				nums[top-1] = nums[top - 1] + nums[top];
				break;
			case '-':
				top--;
				nums[top-1] = nums[top - 1] - nums[top];
				break;
			case '*':
				top--;
				nums[top-1] = nums[top - 1] * nums[top];
				break;
			default:
				
				nums[top] = Integer.parseInt(strs[i]);
				top++;
				break;
			}
			/*System.out.println(Arrays.toString(nums));*/
		}
		System.out.println(nums[0]);

	}
} import java.io.BufferedReader; BufferedReader java.io import java.io.IOException; IOException java.io import java.io.InputStreamReader; InputStreamReader java.io import java.util.Arrays; Arrays java.util public class Main {

	public static void main(String[] args) throws NumberFormatException,
			IOException {
		BufferedReader reader = new BufferedReader(new InputStreamReader(
				System.in));

		String[] strs = reader.readLine().split(" ");
		int[] nums = new int[strs.length];
		int top = 0;
		for (int i = 0; i < strs.length; i++) {
			switch (strs[i].charAt(0)) {
			case '+':
				top--;
				nums[top-1] = nums[top - 1] + nums[top];
				break;
			case '-':
				top--;
				nums[top-1] = nums[top - 1] - nums[top];
				break;
			case '*':
				top--;
				nums[top-1] = nums[top - 1] * nums[top];
				break;
			default:
				
				nums[top] = Integer.parseInt(strs[i]);
				top++;
				break;
			}
			/*System.out.println(Arrays.toString(nums));*/
		}
		System.out.println(nums[0]);

	}
} Main public static void main(String[] args) throws NumberFormatException,
			IOException {
		BufferedReader reader = new BufferedReader(new InputStreamReader(
				System.in));

		String[] strs = reader.readLine().split(" ");
		int[] nums = new int[strs.length];
		int top = 0;
		for (int i = 0; i < strs.length; i++) {
			switch (strs[i].charAt(0)) {
			case '+':
				top--;
				nums[top-1] = nums[top - 1] + nums[top];
				break;
			case '-':
				top--;
				nums[top-1] = nums[top - 1] - nums[top];
				break;
			case '*':
				top--;
				nums[top-1] = nums[top - 1] * nums[top];
				break;
			default:
				
				nums[top] = Integer.parseInt(strs[i]);
				top++;
				break;
			}
			/*System.out.println(Arrays.toString(nums));*/
		}
		System.out.println(nums[0]);

	} main {
		BufferedReader reader = new BufferedReader(new InputStreamReader(
				System.in));

		String[] strs = reader.readLine().split(" ");
		int[] nums = new int[strs.length];
		int top = 0;
		for (int i = 0; i < strs.length; i++) {
			switch (strs[i].charAt(0)) {
			case '+':
				top--;
				nums[top-1] = nums[top - 1] + nums[top];
				break;
			case '-':
				top--;
				nums[top-1] = nums[top - 1] - nums[top];
				break;
			case '*':
				top--;
				nums[top-1] = nums[top - 1] * nums[top];
				break;
			default:
				
				nums[top] = Integer.parseInt(strs[i]);
				top++;
				break;
			}
			/*System.out.println(Arrays.toString(nums));*/
		}
		System.out.println(nums[0]);

	} BufferedReader reader = new BufferedReader(new InputStreamReader(
				System.in)); reader new BufferedReader(new InputStreamReader(
				System.in)) String[] strs = reader.readLine().split(" "); strs reader.readLine().split(" ") reader.readLine().split reader.readLine() reader.readLine reader " " int[] nums = new int[strs.length]; nums new int[strs.length] strs.length strs strs.length int top = 0; top 0 for (int i = 0; i < strs.length; i++) {
			switch (strs[i].charAt(0)) {
			case '+':
				top--;
				nums[top-1] = nums[top - 1] + nums[top];
				break;
			case '-':
				top--;
				nums[top-1] = nums[top - 1] - nums[top];
				break;
			case '*':
				top--;
				nums[top-1] = nums[top - 1] * nums[top];
				break;
			default:
				
				nums[top] = Integer.parseInt(strs[i]);
				top++;
				break;
			}
			/*System.out.println(Arrays.toString(nums));*/
		} int i = 0; int i = 0; i 0 i < strs.length i strs.length strs strs.length i++ i++ i {
			switch (strs[i].charAt(0)) {
			case '+':
				top--;
				nums[top-1] = nums[top - 1] + nums[top];
				break;
			case '-':
				top--;
				nums[top-1] = nums[top - 1] - nums[top];
				break;
			case '*':
				top--;
				nums[top-1] = nums[top - 1] * nums[top];
				break;
			default:
				
				nums[top] = Integer.parseInt(strs[i]);
				top++;
				break;
			}
			/*System.out.println(Arrays.toString(nums));*/
		} {
			switch (strs[i].charAt(0)) {
			case '+':
				top--;
				nums[top-1] = nums[top - 1] + nums[top];
				break;
			case '-':
				top--;
				nums[top-1] = nums[top - 1] - nums[top];
				break;
			case '*':
				top--;
				nums[top-1] = nums[top - 1] * nums[top];
				break;
			default:
				
				nums[top] = Integer.parseInt(strs[i]);
				top++;
				break;
			}
			/*System.out.println(Arrays.toString(nums));*/
		} switch (strs[i].charAt(0)) {
			case '+':
				top--;
				nums[top-1] = nums[top - 1] + nums[top];
				break;
			case '-':
				top--;
				nums[top-1] = nums[top - 1] - nums[top];
				break;
			case '*':
				top--;
				nums[top-1] = nums[top - 1] * nums[top];
				break;
			default:
				
				nums[top] = Integer.parseInt(strs[i]);
				top++;
				break;
			} strs[i].charAt(0) strs[i].charAt strs[i] strs i 0 case '+': '+' case '+': top-- top nums[top-1] = nums[top - 1] + nums[top] nums[top-1] nums top-1 top 1 nums[top - 1] + nums[top] nums[top - 1] nums top - 1 top 1 nums[top] nums top break; case '-': '-' case '-': top-- top nums[top-1] = nums[top - 1] - nums[top] nums[top-1] nums top-1 top 1 nums[top - 1] - nums[top] nums[top - 1] nums top - 1 top 1 nums[top] nums top break; case '*': '*' case '*': top-- top nums[top-1] = nums[top - 1] * nums[top] nums[top-1] nums top-1 top 1 nums[top - 1] * nums[top] nums[top - 1] nums top - 1 top 1 nums[top] nums top break; default: default: nums[top] = Integer.parseInt(strs[i]) nums[top] nums top Integer.parseInt(strs[i]) Integer.parseInt Integer strs[i] strs i top++ top break; System.out.println(nums[0]) System.out.println System.out System System.out nums[0] nums 0 String[] args args public class Main {

	public static void main(String[] args) throws NumberFormatException,
			IOException {
		BufferedReader reader = new BufferedReader(new InputStreamReader(
				System.in));

		String[] strs = reader.readLine().split(" ");
		int[] nums = new int[strs.length];
		int top = 0;
		for (int i = 0; i < strs.length; i++) {
			switch (strs[i].charAt(0)) {
			case '+':
				top--;
				nums[top-1] = nums[top - 1] + nums[top];
				break;
			case '-':
				top--;
				nums[top-1] = nums[top - 1] - nums[top];
				break;
			case '*':
				top--;
				nums[top-1] = nums[top - 1] * nums[top];
				break;
			default:
				
				nums[top] = Integer.parseInt(strs[i]);
				top++;
				break;
			}
			/*System.out.println(Arrays.toString(nums));*/
		}
		System.out.println(nums[0]);

	}
} public class Main {

	public static void main(String[] args) throws NumberFormatException,
			IOException {
		BufferedReader reader = new BufferedReader(new InputStreamReader(
				System.in));

		String[] strs = reader.readLine().split(" ");
		int[] nums = new int[strs.length];
		int top = 0;
		for (int i = 0; i < strs.length; i++) {
			switch (strs[i].charAt(0)) {
			case '+':
				top--;
				nums[top-1] = nums[top - 1] + nums[top];
				break;
			case '-':
				top--;
				nums[top-1] = nums[top - 1] - nums[top];
				break;
			case '*':
				top--;
				nums[top-1] = nums[top - 1] * nums[top];
				break;
			default:
				
				nums[top] = Integer.parseInt(strs[i]);
				top++;
				break;
			}
			/*System.out.println(Arrays.toString(nums));*/
		}
		System.out.println(nums[0]);

	}
} Main

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

public class Main {

	public static void main(String[] args) throws NumberFormatException,
			IOException {
		BufferedReader reader = new BufferedReader(new InputStreamReader(
				System.in));

		String[] strs = reader.readLine().split(" ");
		int[] nums = new int[strs.length];
		int top = 0;
		for (int i = 0; i < strs.length; i++) {
			switch (strs[i].charAt(0)) {
			case '+':
				top--;
				nums[top-1] = nums[top - 1] + nums[top];
				break;
			case '-':
				top--;
				nums[top-1] = nums[top - 1] - nums[top];
				break;
			case '*':
				top--;
				nums[top-1] = nums[top - 1] * nums[top];
				break;
			default:
				
				nums[top] = Integer.parseInt(strs[i]);
				top++;
				break;
			}
			/*System.out.println(Arrays.toString(nums));*/
		}
		System.out.println(nums[0]);

	}
}