import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.List;

public class Main {
	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String str = br.readLine();
		while (str!=null) {
			List<Integer> stack = new ArrayList<>();
			int top = 0;
			String[] data = str.split(" ", 0);
			for (int i = 0; i < data.length; i++) {
				if (data[i].equals("+")) {
					int x = stack.get(top - 1);
					top--;
					int y = stack.get(top - 1);
					top--;
					stack.add(top, x + y);
					top++;
				} else if (data[i].equals("-")) {
					int x = stack.get(top - 1);
					top--;
					int y = stack.get(top - 1);
					top--;
					stack.add(top, y - x);
					top++;
				} else if (data[i].equals("*")) {
					int x = stack.get(top - 1);
					top--;
					int y = stack.get(top - 1);
					top--;
					stack.add(top, x * y);
					top++;
				} else {
					stack.add(top, Integer.parseInt(data[i]));
					top++;
				}
			}
			System.out.println(stack.get(top - 1));
			str = br.readLine();
		}
	}
} import java.io.BufferedReader; BufferedReader java.io import java.io.IOException; IOException java.io import java.io.InputStreamReader; InputStreamReader java.io import java.util.ArrayList; ArrayList java.util import java.util.List; List java.util public class Main {
	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String str = br.readLine();
		while (str!=null) {
			List<Integer> stack = new ArrayList<>();
			int top = 0;
			String[] data = str.split(" ", 0);
			for (int i = 0; i < data.length; i++) {
				if (data[i].equals("+")) {
					int x = stack.get(top - 1);
					top--;
					int y = stack.get(top - 1);
					top--;
					stack.add(top, x + y);
					top++;
				} else if (data[i].equals("-")) {
					int x = stack.get(top - 1);
					top--;
					int y = stack.get(top - 1);
					top--;
					stack.add(top, y - x);
					top++;
				} else if (data[i].equals("*")) {
					int x = stack.get(top - 1);
					top--;
					int y = stack.get(top - 1);
					top--;
					stack.add(top, x * y);
					top++;
				} else {
					stack.add(top, Integer.parseInt(data[i]));
					top++;
				}
			}
			System.out.println(stack.get(top - 1));
			str = br.readLine();
		}
	}
} Main public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String str = br.readLine();
		while (str!=null) {
			List<Integer> stack = new ArrayList<>();
			int top = 0;
			String[] data = str.split(" ", 0);
			for (int i = 0; i < data.length; i++) {
				if (data[i].equals("+")) {
					int x = stack.get(top - 1);
					top--;
					int y = stack.get(top - 1);
					top--;
					stack.add(top, x + y);
					top++;
				} else if (data[i].equals("-")) {
					int x = stack.get(top - 1);
					top--;
					int y = stack.get(top - 1);
					top--;
					stack.add(top, y - x);
					top++;
				} else if (data[i].equals("*")) {
					int x = stack.get(top - 1);
					top--;
					int y = stack.get(top - 1);
					top--;
					stack.add(top, x * y);
					top++;
				} else {
					stack.add(top, Integer.parseInt(data[i]));
					top++;
				}
			}
			System.out.println(stack.get(top - 1));
			str = br.readLine();
		}
	} main {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String str = br.readLine();
		while (str!=null) {
			List<Integer> stack = new ArrayList<>();
			int top = 0;
			String[] data = str.split(" ", 0);
			for (int i = 0; i < data.length; i++) {
				if (data[i].equals("+")) {
					int x = stack.get(top - 1);
					top--;
					int y = stack.get(top - 1);
					top--;
					stack.add(top, x + y);
					top++;
				} else if (data[i].equals("-")) {
					int x = stack.get(top - 1);
					top--;
					int y = stack.get(top - 1);
					top--;
					stack.add(top, y - x);
					top++;
				} else if (data[i].equals("*")) {
					int x = stack.get(top - 1);
					top--;
					int y = stack.get(top - 1);
					top--;
					stack.add(top, x * y);
					top++;
				} else {
					stack.add(top, Integer.parseInt(data[i]));
					top++;
				}
			}
			System.out.println(stack.get(top - 1));
			str = br.readLine();
		}
	} BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); br new BufferedReader(new InputStreamReader(System.in)) String str = br.readLine(); str br.readLine() br.readLine br while (str!=null) {
			List<Integer> stack = new ArrayList<>();
			int top = 0;
			String[] data = str.split(" ", 0);
			for (int i = 0; i < data.length; i++) {
				if (data[i].equals("+")) {
					int x = stack.get(top - 1);
					top--;
					int y = stack.get(top - 1);
					top--;
					stack.add(top, x + y);
					top++;
				} else if (data[i].equals("-")) {
					int x = stack.get(top - 1);
					top--;
					int y = stack.get(top - 1);
					top--;
					stack.add(top, y - x);
					top++;
				} else if (data[i].equals("*")) {
					int x = stack.get(top - 1);
					top--;
					int y = stack.get(top - 1);
					top--;
					stack.add(top, x * y);
					top++;
				} else {
					stack.add(top, Integer.parseInt(data[i]));
					top++;
				}
			}
			System.out.println(stack.get(top - 1));
			str = br.readLine();
		} str!=null str null {
			List<Integer> stack = new ArrayList<>();
			int top = 0;
			String[] data = str.split(" ", 0);
			for (int i = 0; i < data.length; i++) {
				if (data[i].equals("+")) {
					int x = stack.get(top - 1);
					top--;
					int y = stack.get(top - 1);
					top--;
					stack.add(top, x + y);
					top++;
				} else if (data[i].equals("-")) {
					int x = stack.get(top - 1);
					top--;
					int y = stack.get(top - 1);
					top--;
					stack.add(top, y - x);
					top++;
				} else if (data[i].equals("*")) {
					int x = stack.get(top - 1);
					top--;
					int y = stack.get(top - 1);
					top--;
					stack.add(top, x * y);
					top++;
				} else {
					stack.add(top, Integer.parseInt(data[i]));
					top++;
				}
			}
			System.out.println(stack.get(top - 1));
			str = br.readLine();
		} List<Integer> stack = new ArrayList<>(); stack new ArrayList<>() int top = 0; top 0 String[] data = str.split(" ", 0); data str.split(" ", 0) str.split str " " 0 for (int i = 0; i < data.length; i++) {
				if (data[i].equals("+")) {
					int x = stack.get(top - 1);
					top--;
					int y = stack.get(top - 1);
					top--;
					stack.add(top, x + y);
					top++;
				} else if (data[i].equals("-")) {
					int x = stack.get(top - 1);
					top--;
					int y = stack.get(top - 1);
					top--;
					stack.add(top, y - x);
					top++;
				} else if (data[i].equals("*")) {
					int x = stack.get(top - 1);
					top--;
					int y = stack.get(top - 1);
					top--;
					stack.add(top, x * y);
					top++;
				} else {
					stack.add(top, Integer.parseInt(data[i]));
					top++;
				}
			} int i = 0; int i = 0; i 0 i < data.length i data.length data data.length i++ i++ i {
				if (data[i].equals("+")) {
					int x = stack.get(top - 1);
					top--;
					int y = stack.get(top - 1);
					top--;
					stack.add(top, x + y);
					top++;
				} else if (data[i].equals("-")) {
					int x = stack.get(top - 1);
					top--;
					int y = stack.get(top - 1);
					top--;
					stack.add(top, y - x);
					top++;
				} else if (data[i].equals("*")) {
					int x = stack.get(top - 1);
					top--;
					int y = stack.get(top - 1);
					top--;
					stack.add(top, x * y);
					top++;
				} else {
					stack.add(top, Integer.parseInt(data[i]));
					top++;
				}
			} {
				if (data[i].equals("+")) {
					int x = stack.get(top - 1);
					top--;
					int y = stack.get(top - 1);
					top--;
					stack.add(top, x + y);
					top++;
				} else if (data[i].equals("-")) {
					int x = stack.get(top - 1);
					top--;
					int y = stack.get(top - 1);
					top--;
					stack.add(top, y - x);
					top++;
				} else if (data[i].equals("*")) {
					int x = stack.get(top - 1);
					top--;
					int y = stack.get(top - 1);
					top--;
					stack.add(top, x * y);
					top++;
				} else {
					stack.add(top, Integer.parseInt(data[i]));
					top++;
				}
			} if (data[i].equals("+")) {
					int x = stack.get(top - 1);
					top--;
					int y = stack.get(top - 1);
					top--;
					stack.add(top, x + y);
					top++;
				} else if (data[i].equals("-")) {
					int x = stack.get(top - 1);
					top--;
					int y = stack.get(top - 1);
					top--;
					stack.add(top, y - x);
					top++;
				} else if (data[i].equals("*")) {
					int x = stack.get(top - 1);
					top--;
					int y = stack.get(top - 1);
					top--;
					stack.add(top, x * y);
					top++;
				} else {
					stack.add(top, Integer.parseInt(data[i]));
					top++;
				} data[i].equals("+") data[i].equals data[i] data i "+" {
					int x = stack.get(top - 1);
					top--;
					int y = stack.get(top - 1);
					top--;
					stack.add(top, x + y);
					top++;
				} int x = stack.get(top - 1); x stack.get(top - 1) stack.get stack top - 1 top 1 top-- top int y = stack.get(top - 1); y stack.get(top - 1) stack.get stack top - 1 top 1 top-- top stack.add(top, x + y) stack.add stack top x + y x y top++ top if (data[i].equals("-")) {
					int x = stack.get(top - 1);
					top--;
					int y = stack.get(top - 1);
					top--;
					stack.add(top, y - x);
					top++;
				} else if (data[i].equals("*")) {
					int x = stack.get(top - 1);
					top--;
					int y = stack.get(top - 1);
					top--;
					stack.add(top, x * y);
					top++;
				} else {
					stack.add(top, Integer.parseInt(data[i]));
					top++;
				} data[i].equals("-") data[i].equals data[i] data i "-" {
					int x = stack.get(top - 1);
					top--;
					int y = stack.get(top - 1);
					top--;
					stack.add(top, y - x);
					top++;
				} int x = stack.get(top - 1); x stack.get(top - 1) stack.get stack top - 1 top 1 top-- top int y = stack.get(top - 1); y stack.get(top - 1) stack.get stack top - 1 top 1 top-- top stack.add(top, y - x) stack.add stack top y - x y x top++ top if (data[i].equals("*")) {
					int x = stack.get(top - 1);
					top--;
					int y = stack.get(top - 1);
					top--;
					stack.add(top, x * y);
					top++;
				} else {
					stack.add(top, Integer.parseInt(data[i]));
					top++;
				} data[i].equals("*") data[i].equals data[i] data i "*" {
					int x = stack.get(top - 1);
					top--;
					int y = stack.get(top - 1);
					top--;
					stack.add(top, x * y);
					top++;
				} int x = stack.get(top - 1); x stack.get(top - 1) stack.get stack top - 1 top 1 top-- top int y = stack.get(top - 1); y stack.get(top - 1) stack.get stack top - 1 top 1 top-- top stack.add(top, x * y) stack.add stack top x * y x y top++ top {
					stack.add(top, Integer.parseInt(data[i]));
					top++;
				} stack.add(top, Integer.parseInt(data[i])) stack.add stack top Integer.parseInt(data[i]) Integer.parseInt Integer data[i] data i top++ top System.out.println(stack.get(top - 1)) System.out.println System.out System System.out stack.get(top - 1) stack.get stack top - 1 top 1 str = br.readLine() str br.readLine() br.readLine br String[] args args public class Main {
	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String str = br.readLine();
		while (str!=null) {
			List<Integer> stack = new ArrayList<>();
			int top = 0;
			String[] data = str.split(" ", 0);
			for (int i = 0; i < data.length; i++) {
				if (data[i].equals("+")) {
					int x = stack.get(top - 1);
					top--;
					int y = stack.get(top - 1);
					top--;
					stack.add(top, x + y);
					top++;
				} else if (data[i].equals("-")) {
					int x = stack.get(top - 1);
					top--;
					int y = stack.get(top - 1);
					top--;
					stack.add(top, y - x);
					top++;
				} else if (data[i].equals("*")) {
					int x = stack.get(top - 1);
					top--;
					int y = stack.get(top - 1);
					top--;
					stack.add(top, x * y);
					top++;
				} else {
					stack.add(top, Integer.parseInt(data[i]));
					top++;
				}
			}
			System.out.println(stack.get(top - 1));
			str = br.readLine();
		}
	}
} public class Main {
	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String str = br.readLine();
		while (str!=null) {
			List<Integer> stack = new ArrayList<>();
			int top = 0;
			String[] data = str.split(" ", 0);
			for (int i = 0; i < data.length; i++) {
				if (data[i].equals("+")) {
					int x = stack.get(top - 1);
					top--;
					int y = stack.get(top - 1);
					top--;
					stack.add(top, x + y);
					top++;
				} else if (data[i].equals("-")) {
					int x = stack.get(top - 1);
					top--;
					int y = stack.get(top - 1);
					top--;
					stack.add(top, y - x);
					top++;
				} else if (data[i].equals("*")) {
					int x = stack.get(top - 1);
					top--;
					int y = stack.get(top - 1);
					top--;
					stack.add(top, x * y);
					top++;
				} else {
					stack.add(top, Integer.parseInt(data[i]));
					top++;
				}
			}
			System.out.println(stack.get(top - 1));
			str = br.readLine();
		}
	}
} Main
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.List;

public class Main {
	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String str = br.readLine();
		while (str!=null) {
			List<Integer> stack = new ArrayList<>();
			int top = 0;
			String[] data = str.split(" ", 0);
			for (int i = 0; i < data.length; i++) {
				if (data[i].equals("+")) {
					int x = stack.get(top - 1);
					top--;
					int y = stack.get(top - 1);
					top--;
					stack.add(top, x + y);
					top++;
				} else if (data[i].equals("-")) {
					int x = stack.get(top - 1);
					top--;
					int y = stack.get(top - 1);
					top--;
					stack.add(top, y - x);
					top++;
				} else if (data[i].equals("*")) {
					int x = stack.get(top - 1);
					top--;
					int y = stack.get(top - 1);
					top--;
					stack.add(top, x * y);
					top++;
				} else {
					stack.add(top, Integer.parseInt(data[i]));
					top++;
				}
			}
			System.out.println(stack.get(top - 1));
			str = br.readLine();
		}
	}
}