import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO ?????????????????????????????????????????????

//		StackArray sa = new StackArray(1);
//		try {
//			sa.push(1);
//		} catch (Exception e) {
//			System.out.println("catch");
//		} finally {
//			System.out.println("final");
//		}
//		System.out.println("owari");

		Scanner sc = new Scanner(System.in);
		String[] data = sc.nextLine().split(" ");

		StackArray sa = new StackArray(data.length);

		int ans = 0;
		try
		{
			for (int i = 0; i < data.length; i++)
			{
				switch (data[i])
				{
				case "+":
					ans = sa.pop() + sa.pop();
					sa.push(ans);
					break;
				case "-":
					ans = - sa.pop() + sa.pop();
					sa.push(ans);
					break;
				case "*":
					ans = sa.pop() * sa.pop();
					sa.push(ans);
					break;
				default:
					sa.push( Integer.parseInt(data[i]) );
					break;
				}
			}
			System.out.println(sa.pop());
		}
		catch (Exception e)
		{
			System.out.println(e);
		}

	}

	static class StackArray {
		int[] S;

		int top = 0;

		StackArray(int length) {
			this.S = new int[length];
		}

		StackArray initialize() {
			this.top = 0;
			return this;
		}

		boolean isEmpty() {
			return this.top == 0;
		}

		boolean isFull() {
			return this.top >= this.S.length - 1;
		}

		StackArray push(int x) throws Exception {
			if (this.isFull()) {
				throw new Exception();
			}
			this.top++;
			S[this.top] = x;
			return this;
		}

		int pop() throws Exception {
			if (this.isEmpty()) {
				throw new Exception();
			}
			int x = S[top];
			top--;
			return x;
		}

	}
} import java.util.Scanner; Scanner java.util public class Main {

	public static void main(String[] args) {
		// TODO ?????????????????????????????????????????????

//		StackArray sa = new StackArray(1);
//		try {
//			sa.push(1);
//		} catch (Exception e) {
//			System.out.println("catch");
//		} finally {
//			System.out.println("final");
//		}
//		System.out.println("owari");

		Scanner sc = new Scanner(System.in);
		String[] data = sc.nextLine().split(" ");

		StackArray sa = new StackArray(data.length);

		int ans = 0;
		try
		{
			for (int i = 0; i < data.length; i++)
			{
				switch (data[i])
				{
				case "+":
					ans = sa.pop() + sa.pop();
					sa.push(ans);
					break;
				case "-":
					ans = - sa.pop() + sa.pop();
					sa.push(ans);
					break;
				case "*":
					ans = sa.pop() * sa.pop();
					sa.push(ans);
					break;
				default:
					sa.push( Integer.parseInt(data[i]) );
					break;
				}
			}
			System.out.println(sa.pop());
		}
		catch (Exception e)
		{
			System.out.println(e);
		}

	}

	static class StackArray {
		int[] S;

		int top = 0;

		StackArray(int length) {
			this.S = new int[length];
		}

		StackArray initialize() {
			this.top = 0;
			return this;
		}

		boolean isEmpty() {
			return this.top == 0;
		}

		boolean isFull() {
			return this.top >= this.S.length - 1;
		}

		StackArray push(int x) throws Exception {
			if (this.isFull()) {
				throw new Exception();
			}
			this.top++;
			S[this.top] = x;
			return this;
		}

		int pop() throws Exception {
			if (this.isEmpty()) {
				throw new Exception();
			}
			int x = S[top];
			top--;
			return x;
		}

	}
} Main public static void main(String[] args) {
		// TODO ?????????????????????????????????????????????

//		StackArray sa = new StackArray(1);
//		try {
//			sa.push(1);
//		} catch (Exception e) {
//			System.out.println("catch");
//		} finally {
//			System.out.println("final");
//		}
//		System.out.println("owari");

		Scanner sc = new Scanner(System.in);
		String[] data = sc.nextLine().split(" ");

		StackArray sa = new StackArray(data.length);

		int ans = 0;
		try
		{
			for (int i = 0; i < data.length; i++)
			{
				switch (data[i])
				{
				case "+":
					ans = sa.pop() + sa.pop();
					sa.push(ans);
					break;
				case "-":
					ans = - sa.pop() + sa.pop();
					sa.push(ans);
					break;
				case "*":
					ans = sa.pop() * sa.pop();
					sa.push(ans);
					break;
				default:
					sa.push( Integer.parseInt(data[i]) );
					break;
				}
			}
			System.out.println(sa.pop());
		}
		catch (Exception e)
		{
			System.out.println(e);
		}

	} main {
		// TODO ?????????????????????????????????????????????

//		StackArray sa = new StackArray(1);
//		try {
//			sa.push(1);
//		} catch (Exception e) {
//			System.out.println("catch");
//		} finally {
//			System.out.println("final");
//		}
//		System.out.println("owari");

		Scanner sc = new Scanner(System.in);
		String[] data = sc.nextLine().split(" ");

		StackArray sa = new StackArray(data.length);

		int ans = 0;
		try
		{
			for (int i = 0; i < data.length; i++)
			{
				switch (data[i])
				{
				case "+":
					ans = sa.pop() + sa.pop();
					sa.push(ans);
					break;
				case "-":
					ans = - sa.pop() + sa.pop();
					sa.push(ans);
					break;
				case "*":
					ans = sa.pop() * sa.pop();
					sa.push(ans);
					break;
				default:
					sa.push( Integer.parseInt(data[i]) );
					break;
				}
			}
			System.out.println(sa.pop());
		}
		catch (Exception e)
		{
			System.out.println(e);
		}

	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String[] data = sc.nextLine().split(" "); data sc.nextLine().split(" ") sc.nextLine().split sc.nextLine() sc.nextLine sc " " StackArray sa = new StackArray(data.length); sa new StackArray(data.length) int ans = 0; ans 0 try
		{
			for (int i = 0; i < data.length; i++)
			{
				switch (data[i])
				{
				case "+":
					ans = sa.pop() + sa.pop();
					sa.push(ans);
					break;
				case "-":
					ans = - sa.pop() + sa.pop();
					sa.push(ans);
					break;
				case "*":
					ans = sa.pop() * sa.pop();
					sa.push(ans);
					break;
				default:
					sa.push( Integer.parseInt(data[i]) );
					break;
				}
			}
			System.out.println(sa.pop());
		}
		catch (Exception e)
		{
			System.out.println(e);
		} catch (Exception e)
		{
			System.out.println(e);
		} Exception e {
			System.out.println(e);
		} System.out.println(e) System.out.println System.out System System.out e {
			for (int i = 0; i < data.length; i++)
			{
				switch (data[i])
				{
				case "+":
					ans = sa.pop() + sa.pop();
					sa.push(ans);
					break;
				case "-":
					ans = - sa.pop() + sa.pop();
					sa.push(ans);
					break;
				case "*":
					ans = sa.pop() * sa.pop();
					sa.push(ans);
					break;
				default:
					sa.push( Integer.parseInt(data[i]) );
					break;
				}
			}
			System.out.println(sa.pop());
		} for (int i = 0; i < data.length; i++)
			{
				switch (data[i])
				{
				case "+":
					ans = sa.pop() + sa.pop();
					sa.push(ans);
					break;
				case "-":
					ans = - sa.pop() + sa.pop();
					sa.push(ans);
					break;
				case "*":
					ans = sa.pop() * sa.pop();
					sa.push(ans);
					break;
				default:
					sa.push( Integer.parseInt(data[i]) );
					break;
				}
			} int i = 0; int i = 0; i 0 i < data.length i data.length data data.length i++ i++ i {
				switch (data[i])
				{
				case "+":
					ans = sa.pop() + sa.pop();
					sa.push(ans);
					break;
				case "-":
					ans = - sa.pop() + sa.pop();
					sa.push(ans);
					break;
				case "*":
					ans = sa.pop() * sa.pop();
					sa.push(ans);
					break;
				default:
					sa.push( Integer.parseInt(data[i]) );
					break;
				}
			} {
				switch (data[i])
				{
				case "+":
					ans = sa.pop() + sa.pop();
					sa.push(ans);
					break;
				case "-":
					ans = - sa.pop() + sa.pop();
					sa.push(ans);
					break;
				case "*":
					ans = sa.pop() * sa.pop();
					sa.push(ans);
					break;
				default:
					sa.push( Integer.parseInt(data[i]) );
					break;
				}
			} switch (data[i])
				{
				case "+":
					ans = sa.pop() + sa.pop();
					sa.push(ans);
					break;
				case "-":
					ans = - sa.pop() + sa.pop();
					sa.push(ans);
					break;
				case "*":
					ans = sa.pop() * sa.pop();
					sa.push(ans);
					break;
				default:
					sa.push( Integer.parseInt(data[i]) );
					break;
				} data[i] data i case "+": "+" case "+": ans = sa.pop() + sa.pop() ans sa.pop() + sa.pop() sa.pop() sa.pop sa sa.pop() sa.pop sa sa.push(ans) sa.push sa ans break; case "-": "-" case "-": ans = - sa.pop() + sa.pop() ans - sa.pop() + sa.pop() - sa.pop() sa.pop() sa.pop sa sa.pop() sa.pop sa sa.push(ans) sa.push sa ans break; case "*": "*" case "*": ans = sa.pop() * sa.pop() ans sa.pop() * sa.pop() sa.pop() sa.pop sa sa.pop() sa.pop sa sa.push(ans) sa.push sa ans break; default: default: sa.push( Integer.parseInt(data[i]) ) sa.push sa Integer.parseInt(data[i]) Integer.parseInt Integer data[i] data i break; System.out.println(sa.pop()) System.out.println System.out System System.out sa.pop() sa.pop sa String[] args args static class StackArray {
		int[] S;

		int top = 0;

		StackArray(int length) {
			this.S = new int[length];
		}

		StackArray initialize() {
			this.top = 0;
			return this;
		}

		boolean isEmpty() {
			return this.top == 0;
		}

		boolean isFull() {
			return this.top >= this.S.length - 1;
		}

		StackArray push(int x) throws Exception {
			if (this.isFull()) {
				throw new Exception();
			}
			this.top++;
			S[this.top] = x;
			return this;
		}

		int pop() throws Exception {
			if (this.isEmpty()) {
				throw new Exception();
			}
			int x = S[top];
			top--;
			return x;
		}

	} StackArray int[] S; S int top = 0; top 0 StackArray(int length) {
			this.S = new int[length];
		} StackArray {
			this.S = new int[length];
		} this.S = new int[length] this.S this this.S new int[length] length int length length StackArray initialize() {
			this.top = 0;
			return this;
		} initialize {
			this.top = 0;
			return this;
		} this.top = 0 this.top this this.top 0 return this; this boolean isEmpty() {
			return this.top == 0;
		} isEmpty {
			return this.top == 0;
		} return this.top == 0; this.top == 0 this.top this this.top 0 boolean isFull() {
			return this.top >= this.S.length - 1;
		} isFull {
			return this.top >= this.S.length - 1;
		} return this.top >= this.S.length - 1; this.top >= this.S.length - 1 this.top this this.top this.S.length - 1 this.S.length this.S this this.S this.S.length 1 StackArray push(int x) throws Exception {
			if (this.isFull()) {
				throw new Exception();
			}
			this.top++;
			S[this.top] = x;
			return this;
		} push {
			if (this.isFull()) {
				throw new Exception();
			}
			this.top++;
			S[this.top] = x;
			return this;
		} if (this.isFull()) {
				throw new Exception();
			} this.isFull() this.isFull this {
				throw new Exception();
			} throw new Exception(); new Exception() this.top++ this.top this this.top S[this.top] = x S[this.top] S this.top this this.top x return this; this int x x int pop() throws Exception {
			if (this.isEmpty()) {
				throw new Exception();
			}
			int x = S[top];
			top--;
			return x;
		} pop {
			if (this.isEmpty()) {
				throw new Exception();
			}
			int x = S[top];
			top--;
			return x;
		} if (this.isEmpty()) {
				throw new Exception();
			} this.isEmpty() this.isEmpty this {
				throw new Exception();
			} throw new Exception(); new Exception() int x = S[top]; x S[top] S top top-- top return x; x public class Main {

	public static void main(String[] args) {
		// TODO ?????????????????????????????????????????????

//		StackArray sa = new StackArray(1);
//		try {
//			sa.push(1);
//		} catch (Exception e) {
//			System.out.println("catch");
//		} finally {
//			System.out.println("final");
//		}
//		System.out.println("owari");

		Scanner sc = new Scanner(System.in);
		String[] data = sc.nextLine().split(" ");

		StackArray sa = new StackArray(data.length);

		int ans = 0;
		try
		{
			for (int i = 0; i < data.length; i++)
			{
				switch (data[i])
				{
				case "+":
					ans = sa.pop() + sa.pop();
					sa.push(ans);
					break;
				case "-":
					ans = - sa.pop() + sa.pop();
					sa.push(ans);
					break;
				case "*":
					ans = sa.pop() * sa.pop();
					sa.push(ans);
					break;
				default:
					sa.push( Integer.parseInt(data[i]) );
					break;
				}
			}
			System.out.println(sa.pop());
		}
		catch (Exception e)
		{
			System.out.println(e);
		}

	}

	static class StackArray {
		int[] S;

		int top = 0;

		StackArray(int length) {
			this.S = new int[length];
		}

		StackArray initialize() {
			this.top = 0;
			return this;
		}

		boolean isEmpty() {
			return this.top == 0;
		}

		boolean isFull() {
			return this.top >= this.S.length - 1;
		}

		StackArray push(int x) throws Exception {
			if (this.isFull()) {
				throw new Exception();
			}
			this.top++;
			S[this.top] = x;
			return this;
		}

		int pop() throws Exception {
			if (this.isEmpty()) {
				throw new Exception();
			}
			int x = S[top];
			top--;
			return x;
		}

	}
} public class Main {

	public static void main(String[] args) {
		// TODO ?????????????????????????????????????????????

//		StackArray sa = new StackArray(1);
//		try {
//			sa.push(1);
//		} catch (Exception e) {
//			System.out.println("catch");
//		} finally {
//			System.out.println("final");
//		}
//		System.out.println("owari");

		Scanner sc = new Scanner(System.in);
		String[] data = sc.nextLine().split(" ");

		StackArray sa = new StackArray(data.length);

		int ans = 0;
		try
		{
			for (int i = 0; i < data.length; i++)
			{
				switch (data[i])
				{
				case "+":
					ans = sa.pop() + sa.pop();
					sa.push(ans);
					break;
				case "-":
					ans = - sa.pop() + sa.pop();
					sa.push(ans);
					break;
				case "*":
					ans = sa.pop() * sa.pop();
					sa.push(ans);
					break;
				default:
					sa.push( Integer.parseInt(data[i]) );
					break;
				}
			}
			System.out.println(sa.pop());
		}
		catch (Exception e)
		{
			System.out.println(e);
		}

	}

	static class StackArray {
		int[] S;

		int top = 0;

		StackArray(int length) {
			this.S = new int[length];
		}

		StackArray initialize() {
			this.top = 0;
			return this;
		}

		boolean isEmpty() {
			return this.top == 0;
		}

		boolean isFull() {
			return this.top >= this.S.length - 1;
		}

		StackArray push(int x) throws Exception {
			if (this.isFull()) {
				throw new Exception();
			}
			this.top++;
			S[this.top] = x;
			return this;
		}

		int pop() throws Exception {
			if (this.isEmpty()) {
				throw new Exception();
			}
			int x = S[top];
			top--;
			return x;
		}

	}
} Main
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO ?????????????????????????????????????????????

//		StackArray sa = new StackArray(1);
//		try {
//			sa.push(1);
//		} catch (Exception e) {
//			System.out.println("catch");
//		} finally {
//			System.out.println("final");
//		}
//		System.out.println("owari");

		Scanner sc = new Scanner(System.in);
		String[] data = sc.nextLine().split(" ");

		StackArray sa = new StackArray(data.length);

		int ans = 0;
		try
		{
			for (int i = 0; i < data.length; i++)
			{
				switch (data[i])
				{
				case "+":
					ans = sa.pop() + sa.pop();
					sa.push(ans);
					break;
				case "-":
					ans = - sa.pop() + sa.pop();
					sa.push(ans);
					break;
				case "*":
					ans = sa.pop() * sa.pop();
					sa.push(ans);
					break;
				default:
					sa.push( Integer.parseInt(data[i]) );
					break;
				}
			}
			System.out.println(sa.pop());
		}
		catch (Exception e)
		{
			System.out.println(e);
		}

	}

	static class StackArray {
		int[] S;

		int top = 0;

		StackArray(int length) {
			this.S = new int[length];
		}

		StackArray initialize() {
			this.top = 0;
			return this;
		}

		boolean isEmpty() {
			return this.top == 0;
		}

		boolean isFull() {
			return this.top >= this.S.length - 1;
		}

		StackArray push(int x) throws Exception {
			if (this.isFull()) {
				throw new Exception();
			}
			this.top++;
			S[this.top] = x;
			return this;
		}

		int pop() throws Exception {
			if (this.isEmpty()) {
				throw new Exception();
			}
			int x = S[top];
			top--;
			return x;
		}

	}
}