import java.io.BufferedReader;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

public class Main {
	public static void main(String[] args) throws IOException {
		ContestScanner scan = new ContestScanner();

		(new Solve(scan.readLine().split(" "))).solve();
	}
}
class Solve {
	private final String[] tokens;

	public Solve(String[] tokens)
	{
		this.tokens = tokens;
	}

	public void solve()
	{
		Token[] compiledTokens = new Token[tokens.length];

		for(int i=0, l=tokens.length; i < l; i++)
		{
			String token = tokens[i];

			if(token.equals("+"))
			{
				compiledTokens[i] = new AddOperator();
			}
			else if(token.equals("-"))
			{
				compiledTokens[i] = new SubtractOperator();
			}
			else if(token.equals("*"))
			{
				compiledTokens[i] = new MultiplyOperator();
			}
			else if(token.equals("/"))
			{
				compiledTokens[i] = new DivideOperator();
			}
			else
			{
				compiledTokens[i] = new OperandToken(Integer.parseInt(token));
			}
		}
		Token[] stack = new Token[100];

		int stackTop = -1;

		for(Token t: compiledTokens)
		{
			if(t instanceof IOperator)
			{
				OperandToken b = (OperandToken)stack[stackTop--];
				OperandToken a = (OperandToken)stack[stackTop--];

				stack[++stackTop] = new OperandToken(((IOperator)t).apply(a, b));
			}
			else
			{
				stack[++stackTop] = t;
			}
		}

		System.out.println(((OperandToken)stack[stackTop]).value());
	}
}
abstract class Token {

}
class OperandToken extends Token {
	private final int operand;

	public OperandToken(int v)
	{
		operand = v;
	}

	public int value()
	{
		return operand;
	}
}
interface IOperator {
	public int apply(OperandToken a, OperandToken b);
}
abstract class OperatorToken extends Token implements IOperator {
}
class AddOperator extends OperatorToken {
	public int apply(OperandToken a, OperandToken b)
	{
		return a.value() + b.value();
	}
}
class SubtractOperator extends OperatorToken {
	public int apply(OperandToken a, OperandToken b)
	{
		return a.value() - b.value();
	}
}
class MultiplyOperator extends OperatorToken {
	public int apply(OperandToken a, OperandToken b)
	{
		return a.value() * b.value();
	}
}
class DivideOperator extends OperatorToken {
	public int apply(OperandToken a, OperandToken b)
	{
		return a.value() / b.value();
	}
}
class ContestScanner {
	BufferedReader reader;
	String[] line;
	int index;
	public ContestScanner() {
		reader = new BufferedReader(new InputStreamReader(System.in));
	}

	public ContestScanner(String filename) throws FileNotFoundException {
		reader = new BufferedReader(new InputStreamReader(new FileInputStream(filename)));
	}

	public String nextToken() throws IOException {
		if(line == null || index >= line.length)
		{
			line = reader.readLine().trim().split(" ");
			index = 0;
		}

		return line[index++];
	}

	public String next() throws IOException {
		return nextToken();
	}

	public String readLine() throws IOException {
		line = null;
		index = 0;

		return reader.readLine();
	}

	public int nextInt() throws IOException, NumberFormatException {
		return Integer.parseInt(nextToken());
	}

	public long nextLong() throws IOException, NumberFormatException {
		return Long.parseLong(nextToken());
	}

	public double nextDouble() throws IOException, NumberFormatException {
		return Double.parseDouble(nextToken());
	}

	public int[] nextIntArray(int N) throws IOException, NumberFormatException {
		int[] result = new int[N];

		for(int i=0; i < N; i++) result[i] = nextInt();

		return result;
	}

	public long[] nextLongArray(int N) throws IOException, NumberFormatException {
		long[] result = new long[N];

		for(int i=0; i < N; i++) result[i] = nextLong();

		return result;
	}

	public double[] nexDoubleArray(int N) throws IOException, NumberFormatException {
		double[] result = new double[N];

		for(int i=0; i < N; i++) result[i] = nextDouble();

		return result;
	}
} import java.io.BufferedReader; BufferedReader java.io import java.io.FileInputStream; FileInputStream java.io import java.io.FileNotFoundException; FileNotFoundException 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.Arrays; Arrays java.util import java.util.regex.Matcher; Matcher java.util.regex import java.util.regex.Pattern; Pattern java.util.regex public class Main {
	public static void main(String[] args) throws IOException {
		ContestScanner scan = new ContestScanner();

		(new Solve(scan.readLine().split(" "))).solve();
	}
} Main public static void main(String[] args) throws IOException {
		ContestScanner scan = new ContestScanner();

		(new Solve(scan.readLine().split(" "))).solve();
	} main {
		ContestScanner scan = new ContestScanner();

		(new Solve(scan.readLine().split(" "))).solve();
	} ContestScanner scan = new ContestScanner(); scan new ContestScanner() (new Solve(scan.readLine().split(" "))).solve() (new Solve(scan.readLine().split(" "))).solve (new Solve(scan.readLine().split(" "))) String[] args args class Solve {
	private final String[] tokens;

	public Solve(String[] tokens)
	{
		this.tokens = tokens;
	}

	public void solve()
	{
		Token[] compiledTokens = new Token[tokens.length];

		for(int i=0, l=tokens.length; i < l; i++)
		{
			String token = tokens[i];

			if(token.equals("+"))
			{
				compiledTokens[i] = new AddOperator();
			}
			else if(token.equals("-"))
			{
				compiledTokens[i] = new SubtractOperator();
			}
			else if(token.equals("*"))
			{
				compiledTokens[i] = new MultiplyOperator();
			}
			else if(token.equals("/"))
			{
				compiledTokens[i] = new DivideOperator();
			}
			else
			{
				compiledTokens[i] = new OperandToken(Integer.parseInt(token));
			}
		}
		Token[] stack = new Token[100];

		int stackTop = -1;

		for(Token t: compiledTokens)
		{
			if(t instanceof IOperator)
			{
				OperandToken b = (OperandToken)stack[stackTop--];
				OperandToken a = (OperandToken)stack[stackTop--];

				stack[++stackTop] = new OperandToken(((IOperator)t).apply(a, b));
			}
			else
			{
				stack[++stackTop] = t;
			}
		}

		System.out.println(((OperandToken)stack[stackTop]).value());
	}
} Solve private final String[] tokens; tokens public Solve(String[] tokens)
	{
		this.tokens = tokens;
	} Solve {
		this.tokens = tokens;
	} this.tokens = tokens this.tokens this this.tokens tokens String[] tokens tokens public void solve()
	{
		Token[] compiledTokens = new Token[tokens.length];

		for(int i=0, l=tokens.length; i < l; i++)
		{
			String token = tokens[i];

			if(token.equals("+"))
			{
				compiledTokens[i] = new AddOperator();
			}
			else if(token.equals("-"))
			{
				compiledTokens[i] = new SubtractOperator();
			}
			else if(token.equals("*"))
			{
				compiledTokens[i] = new MultiplyOperator();
			}
			else if(token.equals("/"))
			{
				compiledTokens[i] = new DivideOperator();
			}
			else
			{
				compiledTokens[i] = new OperandToken(Integer.parseInt(token));
			}
		}
		Token[] stack = new Token[100];

		int stackTop = -1;

		for(Token t: compiledTokens)
		{
			if(t instanceof IOperator)
			{
				OperandToken b = (OperandToken)stack[stackTop--];
				OperandToken a = (OperandToken)stack[stackTop--];

				stack[++stackTop] = new OperandToken(((IOperator)t).apply(a, b));
			}
			else
			{
				stack[++stackTop] = t;
			}
		}

		System.out.println(((OperandToken)stack[stackTop]).value());
	} solve {
		Token[] compiledTokens = new Token[tokens.length];

		for(int i=0, l=tokens.length; i < l; i++)
		{
			String token = tokens[i];

			if(token.equals("+"))
			{
				compiledTokens[i] = new AddOperator();
			}
			else if(token.equals("-"))
			{
				compiledTokens[i] = new SubtractOperator();
			}
			else if(token.equals("*"))
			{
				compiledTokens[i] = new MultiplyOperator();
			}
			else if(token.equals("/"))
			{
				compiledTokens[i] = new DivideOperator();
			}
			else
			{
				compiledTokens[i] = new OperandToken(Integer.parseInt(token));
			}
		}
		Token[] stack = new Token[100];

		int stackTop = -1;

		for(Token t: compiledTokens)
		{
			if(t instanceof IOperator)
			{
				OperandToken b = (OperandToken)stack[stackTop--];
				OperandToken a = (OperandToken)stack[stackTop--];

				stack[++stackTop] = new OperandToken(((IOperator)t).apply(a, b));
			}
			else
			{
				stack[++stackTop] = t;
			}
		}

		System.out.println(((OperandToken)stack[stackTop]).value());
	} Token[] compiledTokens = new Token[tokens.length]; compiledTokens new Token[tokens.length] tokens.length tokens tokens.length for(int i=0, l=tokens.length; i < l; i++)
		{
			String token = tokens[i];

			if(token.equals("+"))
			{
				compiledTokens[i] = new AddOperator();
			}
			else if(token.equals("-"))
			{
				compiledTokens[i] = new SubtractOperator();
			}
			else if(token.equals("*"))
			{
				compiledTokens[i] = new MultiplyOperator();
			}
			else if(token.equals("/"))
			{
				compiledTokens[i] = new DivideOperator();
			}
			else
			{
				compiledTokens[i] = new OperandToken(Integer.parseInt(token));
			}
		} int i=0, l=tokens.length; int i=0 i 0 l=tokens.length; l tokens.length tokens tokens.length i < l i l i++ i++ i {
			String token = tokens[i];

			if(token.equals("+"))
			{
				compiledTokens[i] = new AddOperator();
			}
			else if(token.equals("-"))
			{
				compiledTokens[i] = new SubtractOperator();
			}
			else if(token.equals("*"))
			{
				compiledTokens[i] = new MultiplyOperator();
			}
			else if(token.equals("/"))
			{
				compiledTokens[i] = new DivideOperator();
			}
			else
			{
				compiledTokens[i] = new OperandToken(Integer.parseInt(token));
			}
		} {
			String token = tokens[i];

			if(token.equals("+"))
			{
				compiledTokens[i] = new AddOperator();
			}
			else if(token.equals("-"))
			{
				compiledTokens[i] = new SubtractOperator();
			}
			else if(token.equals("*"))
			{
				compiledTokens[i] = new MultiplyOperator();
			}
			else if(token.equals("/"))
			{
				compiledTokens[i] = new DivideOperator();
			}
			else
			{
				compiledTokens[i] = new OperandToken(Integer.parseInt(token));
			}
		} String token = tokens[i]; token tokens[i] tokens i if(token.equals("+"))
			{
				compiledTokens[i] = new AddOperator();
			}
			else if(token.equals("-"))
			{
				compiledTokens[i] = new SubtractOperator();
			}
			else if(token.equals("*"))
			{
				compiledTokens[i] = new MultiplyOperator();
			}
			else if(token.equals("/"))
			{
				compiledTokens[i] = new DivideOperator();
			}
			else
			{
				compiledTokens[i] = new OperandToken(Integer.parseInt(token));
			} token.equals("+") token.equals token "+" {
				compiledTokens[i] = new AddOperator();
			} compiledTokens[i] = new AddOperator() compiledTokens[i] compiledTokens i new AddOperator() if(token.equals("-"))
			{
				compiledTokens[i] = new SubtractOperator();
			}
			else if(token.equals("*"))
			{
				compiledTokens[i] = new MultiplyOperator();
			}
			else if(token.equals("/"))
			{
				compiledTokens[i] = new DivideOperator();
			}
			else
			{
				compiledTokens[i] = new OperandToken(Integer.parseInt(token));
			} token.equals("-") token.equals token "-" {
				compiledTokens[i] = new SubtractOperator();
			} compiledTokens[i] = new SubtractOperator() compiledTokens[i] compiledTokens i new SubtractOperator() if(token.equals("*"))
			{
				compiledTokens[i] = new MultiplyOperator();
			}
			else if(token.equals("/"))
			{
				compiledTokens[i] = new DivideOperator();
			}
			else
			{
				compiledTokens[i] = new OperandToken(Integer.parseInt(token));
			} token.equals("*") token.equals token "*" {
				compiledTokens[i] = new MultiplyOperator();
			} compiledTokens[i] = new MultiplyOperator() compiledTokens[i] compiledTokens i new MultiplyOperator() if(token.equals("/"))
			{
				compiledTokens[i] = new DivideOperator();
			}
			else
			{
				compiledTokens[i] = new OperandToken(Integer.parseInt(token));
			} token.equals("/") token.equals token "/" {
				compiledTokens[i] = new DivideOperator();
			} compiledTokens[i] = new DivideOperator() compiledTokens[i] compiledTokens i new DivideOperator() {
				compiledTokens[i] = new OperandToken(Integer.parseInt(token));
			} compiledTokens[i] = new OperandToken(Integer.parseInt(token)) compiledTokens[i] compiledTokens i new OperandToken(Integer.parseInt(token)) Token[] stack = new Token[100]; stack new Token[100] 100 int stackTop = -1; stackTop -1 1 for(Token t: compiledTokens)
		{
			if(t instanceof IOperator)
			{
				OperandToken b = (OperandToken)stack[stackTop--];
				OperandToken a = (OperandToken)stack[stackTop--];

				stack[++stackTop] = new OperandToken(((IOperator)t).apply(a, b));
			}
			else
			{
				stack[++stackTop] = t;
			}
		} Token t compiledTokens {
			if(t instanceof IOperator)
			{
				OperandToken b = (OperandToken)stack[stackTop--];
				OperandToken a = (OperandToken)stack[stackTop--];

				stack[++stackTop] = new OperandToken(((IOperator)t).apply(a, b));
			}
			else
			{
				stack[++stackTop] = t;
			}
		} {
			if(t instanceof IOperator)
			{
				OperandToken b = (OperandToken)stack[stackTop--];
				OperandToken a = (OperandToken)stack[stackTop--];

				stack[++stackTop] = new OperandToken(((IOperator)t).apply(a, b));
			}
			else
			{
				stack[++stackTop] = t;
			}
		} if(t instanceof IOperator)
			{
				OperandToken b = (OperandToken)stack[stackTop--];
				OperandToken a = (OperandToken)stack[stackTop--];

				stack[++stackTop] = new OperandToken(((IOperator)t).apply(a, b));
			}
			else
			{
				stack[++stackTop] = t;
			} t instanceof IOperator t IOperator {
				OperandToken b = (OperandToken)stack[stackTop--];
				OperandToken a = (OperandToken)stack[stackTop--];

				stack[++stackTop] = new OperandToken(((IOperator)t).apply(a, b));
			} OperandToken b = (OperandToken)stack[stackTop--]; b (OperandToken)stack[stackTop--] stack stackTop-- stackTop OperandToken a = (OperandToken)stack[stackTop--]; a (OperandToken)stack[stackTop--] stack stackTop-- stackTop stack[++stackTop] = new OperandToken(((IOperator)t).apply(a, b)) stack[++stackTop] stack ++stackTop stackTop new OperandToken(((IOperator)t).apply(a, b)) {
				stack[++stackTop] = t;
			} stack[++stackTop] = t stack[++stackTop] stack ++stackTop stackTop t System.out.println(((OperandToken)stack[stackTop]).value()) System.out.println System.out System System.out ((OperandToken)stack[stackTop]).value() ((OperandToken)stack[stackTop]).value ((OperandToken)stack[stackTop]) stack stackTop abstract class Token {

} Token class OperandToken extends Token {
	private final int operand;

	public OperandToken(int v)
	{
		operand = v;
	}

	public int value()
	{
		return operand;
	}
} OperandToken private final int operand; operand public OperandToken(int v)
	{
		operand = v;
	} OperandToken {
		operand = v;
	} operand = v operand v int v v public int value()
	{
		return operand;
	} value {
		return operand;
	} return operand; operand Token interface IOperator {
	public int apply(OperandToken a, OperandToken b);
} IOperator public int apply(OperandToken a, OperandToken b); apply OperandToken a a OperandToken b b abstract class OperatorToken extends Token implements IOperator {
} OperatorToken Token IOperator class AddOperator extends OperatorToken {
	public int apply(OperandToken a, OperandToken b)
	{
		return a.value() + b.value();
	}
} AddOperator public int apply(OperandToken a, OperandToken b)
	{
		return a.value() + b.value();
	} apply {
		return a.value() + b.value();
	} return a.value() + b.value(); a.value() + b.value() a.value() a.value a b.value() b.value b OperandToken a a OperandToken b b OperatorToken class SubtractOperator extends OperatorToken {
	public int apply(OperandToken a, OperandToken b)
	{
		return a.value() - b.value();
	}
} SubtractOperator public int apply(OperandToken a, OperandToken b)
	{
		return a.value() - b.value();
	} apply {
		return a.value() - b.value();
	} return a.value() - b.value(); a.value() - b.value() a.value() a.value a b.value() b.value b OperandToken a a OperandToken b b OperatorToken class MultiplyOperator extends OperatorToken {
	public int apply(OperandToken a, OperandToken b)
	{
		return a.value() * b.value();
	}
} MultiplyOperator public int apply(OperandToken a, OperandToken b)
	{
		return a.value() * b.value();
	} apply {
		return a.value() * b.value();
	} return a.value() * b.value(); a.value() * b.value() a.value() a.value a b.value() b.value b OperandToken a a OperandToken b b OperatorToken class DivideOperator extends OperatorToken {
	public int apply(OperandToken a, OperandToken b)
	{
		return a.value() / b.value();
	}
} DivideOperator public int apply(OperandToken a, OperandToken b)
	{
		return a.value() / b.value();
	} apply {
		return a.value() / b.value();
	} return a.value() / b.value(); a.value() / b.value() a.value() a.value a b.value() b.value b OperandToken a a OperandToken b b OperatorToken class ContestScanner {
	BufferedReader reader;
	String[] line;
	int index;
	public ContestScanner() {
		reader = new BufferedReader(new InputStreamReader(System.in));
	}

	public ContestScanner(String filename) throws FileNotFoundException {
		reader = new BufferedReader(new InputStreamReader(new FileInputStream(filename)));
	}

	public String nextToken() throws IOException {
		if(line == null || index >= line.length)
		{
			line = reader.readLine().trim().split(" ");
			index = 0;
		}

		return line[index++];
	}

	public String next() throws IOException {
		return nextToken();
	}

	public String readLine() throws IOException {
		line = null;
		index = 0;

		return reader.readLine();
	}

	public int nextInt() throws IOException, NumberFormatException {
		return Integer.parseInt(nextToken());
	}

	public long nextLong() throws IOException, NumberFormatException {
		return Long.parseLong(nextToken());
	}

	public double nextDouble() throws IOException, NumberFormatException {
		return Double.parseDouble(nextToken());
	}

	public int[] nextIntArray(int N) throws IOException, NumberFormatException {
		int[] result = new int[N];

		for(int i=0; i < N; i++) result[i] = nextInt();

		return result;
	}

	public long[] nextLongArray(int N) throws IOException, NumberFormatException {
		long[] result = new long[N];

		for(int i=0; i < N; i++) result[i] = nextLong();

		return result;
	}

	public double[] nexDoubleArray(int N) throws IOException, NumberFormatException {
		double[] result = new double[N];

		for(int i=0; i < N; i++) result[i] = nextDouble();

		return result;
	}
} ContestScanner BufferedReader reader; reader String[] line; line int index; index public ContestScanner() {
		reader = new BufferedReader(new InputStreamReader(System.in));
	} ContestScanner {
		reader = new BufferedReader(new InputStreamReader(System.in));
	} reader = new BufferedReader(new InputStreamReader(System.in)) reader new BufferedReader(new InputStreamReader(System.in)) public ContestScanner(String filename) throws FileNotFoundException {
		reader = new BufferedReader(new InputStreamReader(new FileInputStream(filename)));
	} ContestScanner {
		reader = new BufferedReader(new InputStreamReader(new FileInputStream(filename)));
	} reader = new BufferedReader(new InputStreamReader(new FileInputStream(filename))) reader new BufferedReader(new InputStreamReader(new FileInputStream(filename))) String filename filename public String nextToken() throws IOException {
		if(line == null || index >= line.length)
		{
			line = reader.readLine().trim().split(" ");
			index = 0;
		}

		return line[index++];
	} nextToken {
		if(line == null || index >= line.length)
		{
			line = reader.readLine().trim().split(" ");
			index = 0;
		}

		return line[index++];
	} if(line == null || index >= line.length)
		{
			line = reader.readLine().trim().split(" ");
			index = 0;
		} line == null || index >= line.length line == null line null index >= line.length index line.length line line.length {
			line = reader.readLine().trim().split(" ");
			index = 0;
		} line = reader.readLine().trim().split(" ") line reader.readLine().trim().split(" ") reader.readLine().trim().split reader.readLine().trim() reader.readLine().trim reader.readLine() reader.readLine reader " " index = 0 index 0 return line[index++]; line[index++] line index++ index public String next() throws IOException {
		return nextToken();
	} next {
		return nextToken();
	} return nextToken(); nextToken() nextToken public String readLine() throws IOException {
		line = null;
		index = 0;

		return reader.readLine();
	} readLine {
		line = null;
		index = 0;

		return reader.readLine();
	} line = null line null index = 0 index 0 return reader.readLine(); reader.readLine() reader.readLine reader public int nextInt() throws IOException, NumberFormatException {
		return Integer.parseInt(nextToken());
	} nextInt {
		return Integer.parseInt(nextToken());
	} return Integer.parseInt(nextToken()); Integer.parseInt(nextToken()) Integer.parseInt Integer nextToken() nextToken public long nextLong() throws IOException, NumberFormatException {
		return Long.parseLong(nextToken());
	} nextLong {
		return Long.parseLong(nextToken());
	} return Long.parseLong(nextToken()); Long.parseLong(nextToken()) Long.parseLong Long nextToken() nextToken public double nextDouble() throws IOException, NumberFormatException {
		return Double.parseDouble(nextToken());
	} nextDouble {
		return Double.parseDouble(nextToken());
	} return Double.parseDouble(nextToken()); Double.parseDouble(nextToken()) Double.parseDouble Double nextToken() nextToken public int[] nextIntArray(int N) throws IOException, NumberFormatException {
		int[] result = new int[N];

		for(int i=0; i < N; i++) result[i] = nextInt();

		return result;
	} nextIntArray {
		int[] result = new int[N];

		for(int i=0; i < N; i++) result[i] = nextInt();

		return result;
	} int[] result = new int[N]; result new int[N] N for(int i=0; i < N; i++) result[i] = nextInt(); int i=0; int i=0; i 0 i < N i N i++ i++ i result[i] = nextInt(); result[i] = nextInt() result[i] result i nextInt() nextInt return result; result int N N public long[] nextLongArray(int N) throws IOException, NumberFormatException {
		long[] result = new long[N];

		for(int i=0; i < N; i++) result[i] = nextLong();

		return result;
	} nextLongArray {
		long[] result = new long[N];

		for(int i=0; i < N; i++) result[i] = nextLong();

		return result;
	} long[] result = new long[N]; result new long[N] N for(int i=0; i < N; i++) result[i] = nextLong(); int i=0; int i=0; i 0 i < N i N i++ i++ i result[i] = nextLong(); result[i] = nextLong() result[i] result i nextLong() nextLong return result; result int N N public double[] nexDoubleArray(int N) throws IOException, NumberFormatException {
		double[] result = new double[N];

		for(int i=0; i < N; i++) result[i] = nextDouble();

		return result;
	} nexDoubleArray {
		double[] result = new double[N];

		for(int i=0; i < N; i++) result[i] = nextDouble();

		return result;
	} double[] result = new double[N]; result new double[N] N for(int i=0; i < N; i++) result[i] = nextDouble(); int i=0; int i=0; i 0 i < N i N i++ i++ i result[i] = nextDouble(); result[i] = nextDouble() result[i] result i nextDouble() nextDouble return result; result int N N public class Main {
	public static void main(String[] args) throws IOException {
		ContestScanner scan = new ContestScanner();

		(new Solve(scan.readLine().split(" "))).solve();
	}
} public class Main {
	public static void main(String[] args) throws IOException {
		ContestScanner scan = new ContestScanner();

		(new Solve(scan.readLine().split(" "))).solve();
	}
} Main
import java.io.BufferedReader;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

public class Main {
	public static void main(String[] args) throws IOException {
		ContestScanner scan = new ContestScanner();

		(new Solve(scan.readLine().split(" "))).solve();
	}
}
class Solve {
	private final String[] tokens;

	public Solve(String[] tokens)
	{
		this.tokens = tokens;
	}

	public void solve()
	{
		Token[] compiledTokens = new Token[tokens.length];

		for(int i=0, l=tokens.length; i < l; i++)
		{
			String token = tokens[i];

			if(token.equals("+"))
			{
				compiledTokens[i] = new AddOperator();
			}
			else if(token.equals("-"))
			{
				compiledTokens[i] = new SubtractOperator();
			}
			else if(token.equals("*"))
			{
				compiledTokens[i] = new MultiplyOperator();
			}
			else if(token.equals("/"))
			{
				compiledTokens[i] = new DivideOperator();
			}
			else
			{
				compiledTokens[i] = new OperandToken(Integer.parseInt(token));
			}
		}
		Token[] stack = new Token[100];

		int stackTop = -1;

		for(Token t: compiledTokens)
		{
			if(t instanceof IOperator)
			{
				OperandToken b = (OperandToken)stack[stackTop--];
				OperandToken a = (OperandToken)stack[stackTop--];

				stack[++stackTop] = new OperandToken(((IOperator)t).apply(a, b));
			}
			else
			{
				stack[++stackTop] = t;
			}
		}

		System.out.println(((OperandToken)stack[stackTop]).value());
	}
}
abstract class Token {

}
class OperandToken extends Token {
	private final int operand;

	public OperandToken(int v)
	{
		operand = v;
	}

	public int value()
	{
		return operand;
	}
}
interface IOperator {
	public int apply(OperandToken a, OperandToken b);
}
abstract class OperatorToken extends Token implements IOperator {
}
class AddOperator extends OperatorToken {
	public int apply(OperandToken a, OperandToken b)
	{
		return a.value() + b.value();
	}
}
class SubtractOperator extends OperatorToken {
	public int apply(OperandToken a, OperandToken b)
	{
		return a.value() - b.value();
	}
}
class MultiplyOperator extends OperatorToken {
	public int apply(OperandToken a, OperandToken b)
	{
		return a.value() * b.value();
	}
}
class DivideOperator extends OperatorToken {
	public int apply(OperandToken a, OperandToken b)
	{
		return a.value() / b.value();
	}
}
class ContestScanner {
	BufferedReader reader;
	String[] line;
	int index;
	public ContestScanner() {
		reader = new BufferedReader(new InputStreamReader(System.in));
	}

	public ContestScanner(String filename) throws FileNotFoundException {
		reader = new BufferedReader(new InputStreamReader(new FileInputStream(filename)));
	}

	public String nextToken() throws IOException {
		if(line == null || index >= line.length)
		{
			line = reader.readLine().trim().split(" ");
			index = 0;
		}

		return line[index++];
	}

	public String next() throws IOException {
		return nextToken();
	}

	public String readLine() throws IOException {
		line = null;
		index = 0;

		return reader.readLine();
	}

	public int nextInt() throws IOException, NumberFormatException {
		return Integer.parseInt(nextToken());
	}

	public long nextLong() throws IOException, NumberFormatException {
		return Long.parseLong(nextToken());
	}

	public double nextDouble() throws IOException, NumberFormatException {
		return Double.parseDouble(nextToken());
	}

	public int[] nextIntArray(int N) throws IOException, NumberFormatException {
		int[] result = new int[N];

		for(int i=0; i < N; i++) result[i] = nextInt();

		return result;
	}

	public long[] nextLongArray(int N) throws IOException, NumberFormatException {
		long[] result = new long[N];

		for(int i=0; i < N; i++) result[i] = nextLong();

		return result;
	}

	public double[] nexDoubleArray(int N) throws IOException, NumberFormatException {
		double[] result = new double[N];

		for(int i=0; i < N; i++) result[i] = nextDouble();

		return result;
	}
}