import java.util.StringTokenizer;
import java.io.BufferedReader;
import java.io.InputStream;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.Scanner;

class Main{
    public static void main(String[] args){
	Scanner sc = new Scanner(System.in);
	int x;
	String s; 
	Stack stack = new Stack();
	s = sc.nextLine();
	char[] str = s.toCharArray();
	int len = s.length();
	int num = 0;
	for(int i = 0;i < len;i++){
	    num = 0;
	    boolean f = false;
	    while(i < len && str[i] <= '9' && str[i] >= '0'){
		num *= 10;
		num += str[i] - '0';
		i++;
		f = true;
	    }
	    if(f){
		i--;
		stack.push(num);
	    }else if(str[i]=='+' || str[i]=='-' || str[i]=='*' || str[i]=='/'){
		int b = (int)stack.pop();
		int a = (int)stack.pop();
		switch(str[i]) {
		case '+': stack.push(a + b); break;
		case '-': stack.push(a - b); break;
		case '*': stack.push(a * b); break;
		case '/': stack.push(a / b); break;
		default: break;
		}
	    }
	}
	System.out.println((int)stack.pop());
    }
}


class Stack{
    private int top = 0;
    private int[]  S = new int[200]; 
    private static final int MAX = 10;
    public void initialize(){
	top = 0;
    }
    public boolean isEmpty(){
	return top == 0;
    }
    public boolean isFull(){
    	return top >= MAX - 1;
    }
    public void push(int x){
    	/*if(isFull()){
	    System.out.println("Stack over flow");
    	}*/
    	top++;
    	S[top] = x;
    }
    public int pop(){
	/*if(isEmpty()){
	    throw new RuntimeException("Stack under flow");
	}*/
	top--;
	return S[top + 1];
	
    }
    
} import java.util.StringTokenizer; StringTokenizer java.util import java.io.BufferedReader; BufferedReader java.io import java.io.InputStream; InputStream java.io import java.io.IOException; IOException java.io import java.io.InputStreamReader; InputStreamReader java.io import java.util.Arrays; Arrays java.util import java.util.Scanner; Scanner java.util class Main{
    public static void main(String[] args){
	Scanner sc = new Scanner(System.in);
	int x;
	String s; 
	Stack stack = new Stack();
	s = sc.nextLine();
	char[] str = s.toCharArray();
	int len = s.length();
	int num = 0;
	for(int i = 0;i < len;i++){
	    num = 0;
	    boolean f = false;
	    while(i < len && str[i] <= '9' && str[i] >= '0'){
		num *= 10;
		num += str[i] - '0';
		i++;
		f = true;
	    }
	    if(f){
		i--;
		stack.push(num);
	    }else if(str[i]=='+' || str[i]=='-' || str[i]=='*' || str[i]=='/'){
		int b = (int)stack.pop();
		int a = (int)stack.pop();
		switch(str[i]) {
		case '+': stack.push(a + b); break;
		case '-': stack.push(a - b); break;
		case '*': stack.push(a * b); break;
		case '/': stack.push(a / b); break;
		default: break;
		}
	    }
	}
	System.out.println((int)stack.pop());
    }
} Main public static void main(String[] args){
	Scanner sc = new Scanner(System.in);
	int x;
	String s; 
	Stack stack = new Stack();
	s = sc.nextLine();
	char[] str = s.toCharArray();
	int len = s.length();
	int num = 0;
	for(int i = 0;i < len;i++){
	    num = 0;
	    boolean f = false;
	    while(i < len && str[i] <= '9' && str[i] >= '0'){
		num *= 10;
		num += str[i] - '0';
		i++;
		f = true;
	    }
	    if(f){
		i--;
		stack.push(num);
	    }else if(str[i]=='+' || str[i]=='-' || str[i]=='*' || str[i]=='/'){
		int b = (int)stack.pop();
		int a = (int)stack.pop();
		switch(str[i]) {
		case '+': stack.push(a + b); break;
		case '-': stack.push(a - b); break;
		case '*': stack.push(a * b); break;
		case '/': stack.push(a / b); break;
		default: break;
		}
	    }
	}
	System.out.println((int)stack.pop());
    } main {
	Scanner sc = new Scanner(System.in);
	int x;
	String s; 
	Stack stack = new Stack();
	s = sc.nextLine();
	char[] str = s.toCharArray();
	int len = s.length();
	int num = 0;
	for(int i = 0;i < len;i++){
	    num = 0;
	    boolean f = false;
	    while(i < len && str[i] <= '9' && str[i] >= '0'){
		num *= 10;
		num += str[i] - '0';
		i++;
		f = true;
	    }
	    if(f){
		i--;
		stack.push(num);
	    }else if(str[i]=='+' || str[i]=='-' || str[i]=='*' || str[i]=='/'){
		int b = (int)stack.pop();
		int a = (int)stack.pop();
		switch(str[i]) {
		case '+': stack.push(a + b); break;
		case '-': stack.push(a - b); break;
		case '*': stack.push(a * b); break;
		case '/': stack.push(a / b); break;
		default: break;
		}
	    }
	}
	System.out.println((int)stack.pop());
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int x; x String s; s Stack stack = new Stack(); stack new Stack() s = sc.nextLine() s sc.nextLine() sc.nextLine sc char[] str = s.toCharArray(); str s.toCharArray() s.toCharArray s int len = s.length(); len s.length() s.length s int num = 0; num 0 for(int i = 0;i < len;i++){
	    num = 0;
	    boolean f = false;
	    while(i < len && str[i] <= '9' && str[i] >= '0'){
		num *= 10;
		num += str[i] - '0';
		i++;
		f = true;
	    }
	    if(f){
		i--;
		stack.push(num);
	    }else if(str[i]=='+' || str[i]=='-' || str[i]=='*' || str[i]=='/'){
		int b = (int)stack.pop();
		int a = (int)stack.pop();
		switch(str[i]) {
		case '+': stack.push(a + b); break;
		case '-': stack.push(a - b); break;
		case '*': stack.push(a * b); break;
		case '/': stack.push(a / b); break;
		default: break;
		}
	    }
	} int i = 0; int i = 0; i 0 i < len i len i++ i++ i {
	    num = 0;
	    boolean f = false;
	    while(i < len && str[i] <= '9' && str[i] >= '0'){
		num *= 10;
		num += str[i] - '0';
		i++;
		f = true;
	    }
	    if(f){
		i--;
		stack.push(num);
	    }else if(str[i]=='+' || str[i]=='-' || str[i]=='*' || str[i]=='/'){
		int b = (int)stack.pop();
		int a = (int)stack.pop();
		switch(str[i]) {
		case '+': stack.push(a + b); break;
		case '-': stack.push(a - b); break;
		case '*': stack.push(a * b); break;
		case '/': stack.push(a / b); break;
		default: break;
		}
	    }
	} {
	    num = 0;
	    boolean f = false;
	    while(i < len && str[i] <= '9' && str[i] >= '0'){
		num *= 10;
		num += str[i] - '0';
		i++;
		f = true;
	    }
	    if(f){
		i--;
		stack.push(num);
	    }else if(str[i]=='+' || str[i]=='-' || str[i]=='*' || str[i]=='/'){
		int b = (int)stack.pop();
		int a = (int)stack.pop();
		switch(str[i]) {
		case '+': stack.push(a + b); break;
		case '-': stack.push(a - b); break;
		case '*': stack.push(a * b); break;
		case '/': stack.push(a / b); break;
		default: break;
		}
	    }
	} num = 0 num 0 boolean f = false; f false while(i < len && str[i] <= '9' && str[i] >= '0'){
		num *= 10;
		num += str[i] - '0';
		i++;
		f = true;
	    } i < len && str[i] <= '9' && str[i] >= '0' i < len && str[i] <= '9' && str[i] >= '0' i < len i len str[i] <= '9' str[i] str i '9' str[i] >= '0' str[i] str i '0' {
		num *= 10;
		num += str[i] - '0';
		i++;
		f = true;
	    } num *= 10 num 10 num += str[i] - '0' num str[i] - '0' str[i] str i '0' i++ i f = true f true if(f){
		i--;
		stack.push(num);
	    }else if(str[i]=='+' || str[i]=='-' || str[i]=='*' || str[i]=='/'){
		int b = (int)stack.pop();
		int a = (int)stack.pop();
		switch(str[i]) {
		case '+': stack.push(a + b); break;
		case '-': stack.push(a - b); break;
		case '*': stack.push(a * b); break;
		case '/': stack.push(a / b); break;
		default: break;
		}
	    } f {
		i--;
		stack.push(num);
	    } i-- i stack.push(num) stack.push stack num if(str[i]=='+' || str[i]=='-' || str[i]=='*' || str[i]=='/'){
		int b = (int)stack.pop();
		int a = (int)stack.pop();
		switch(str[i]) {
		case '+': stack.push(a + b); break;
		case '-': stack.push(a - b); break;
		case '*': stack.push(a * b); break;
		case '/': stack.push(a / b); break;
		default: break;
		}
	    } str[i]=='+' || str[i]=='-' || str[i]=='*' || str[i]=='/' str[i]=='*' str[i]=='+' || str[i]=='-' || str[i]=='*' || str[i]=='/' str[i]=='+' str[i] str i '+' str[i]=='-' str[i] str i '-' str[i]=='*' str[i] str i '*' str[i]=='/' str[i] str i '/' {
		int b = (int)stack.pop();
		int a = (int)stack.pop();
		switch(str[i]) {
		case '+': stack.push(a + b); break;
		case '-': stack.push(a - b); break;
		case '*': stack.push(a * b); break;
		case '/': stack.push(a / b); break;
		default: break;
		}
	    } int b = (int)stack.pop(); b (int)stack.pop() stack.pop stack int a = (int)stack.pop(); a (int)stack.pop() stack.pop stack switch(str[i]) {
		case '+': stack.push(a + b); break;
		case '-': stack.push(a - b); break;
		case '*': stack.push(a * b); break;
		case '/': stack.push(a / b); break;
		default: break;
		} str[i] str i case '+': '+' case '+': stack.push(a + b) stack.push stack a + b a b break; case '-': '-' case '-': stack.push(a - b) stack.push stack a - b a b break; case '*': '*' case '*': stack.push(a * b) stack.push stack a * b a b break; case '/': '/' case '/': stack.push(a / b) stack.push stack a / b a b break; default: default: break; System.out.println((int)stack.pop()) System.out.println System.out System System.out (int)stack.pop() stack.pop stack String[] args args class Stack{
    private int top = 0;
    private int[]  S = new int[200]; 
    private static final int MAX = 10;
    public void initialize(){
	top = 0;
    }
    public boolean isEmpty(){
	return top == 0;
    }
    public boolean isFull(){
    	return top >= MAX - 1;
    }
    public void push(int x){
    	/*if(isFull()){
	    System.out.println("Stack over flow");
    	}*/
    	top++;
    	S[top] = x;
    }
    public int pop(){
	/*if(isEmpty()){
	    throw new RuntimeException("Stack under flow");
	}*/
	top--;
	return S[top + 1];
	
    }
    
} Stack private int top = 0; top 0 private int[]  S = new int[200]; S new int[200] 200 private static final int MAX = 10; MAX 10 public void initialize(){
	top = 0;
    } initialize {
	top = 0;
    } top = 0 top 0 public boolean isEmpty(){
	return top == 0;
    } isEmpty {
	return top == 0;
    } return top == 0; top == 0 top 0 public boolean isFull(){
    	return top >= MAX - 1;
    } isFull {
    	return top >= MAX - 1;
    } return top >= MAX - 1; top >= MAX - 1 top MAX - 1 MAX 1 public void push(int x){
    	/*if(isFull()){
	    System.out.println("Stack over flow");
    	}*/
    	top++;
    	S[top] = x;
    } push {
    	/*if(isFull()){
	    System.out.println("Stack over flow");
    	}*/
    	top++;
    	S[top] = x;
    } top++ top S[top] = x S[top] S top x int x x public int pop(){
	/*if(isEmpty()){
	    throw new RuntimeException("Stack under flow");
	}*/
	top--;
	return S[top + 1];
	
    } pop {
	/*if(isEmpty()){
	    throw new RuntimeException("Stack under flow");
	}*/
	top--;
	return S[top + 1];
	
    } top-- top return S[top + 1]; S[top + 1] S top + 1 top 1
import java.util.StringTokenizer;
import java.io.BufferedReader;
import java.io.InputStream;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.Scanner;

class Main{
    public static void main(String[] args){
	Scanner sc = new Scanner(System.in);
	int x;
	String s; 
	Stack stack = new Stack();
	s = sc.nextLine();
	char[] str = s.toCharArray();
	int len = s.length();
	int num = 0;
	for(int i = 0;i < len;i++){
	    num = 0;
	    boolean f = false;
	    while(i < len && str[i] <= '9' && str[i] >= '0'){
		num *= 10;
		num += str[i] - '0';
		i++;
		f = true;
	    }
	    if(f){
		i--;
		stack.push(num);
	    }else if(str[i]=='+' || str[i]=='-' || str[i]=='*' || str[i]=='/'){
		int b = (int)stack.pop();
		int a = (int)stack.pop();
		switch(str[i]) {
		case '+': stack.push(a + b); break;
		case '-': stack.push(a - b); break;
		case '*': stack.push(a * b); break;
		case '/': stack.push(a / b); break;
		default: break;
		}
	    }
	}
	System.out.println((int)stack.pop());
    }
}


class Stack{
    private int top = 0;
    private int[]  S = new int[200]; 
    private static final int MAX = 10;
    public void initialize(){
	top = 0;
    }
    public boolean isEmpty(){
	return top == 0;
    }
    public boolean isFull(){
    	return top >= MAX - 1;
    }
    public void push(int x){
    	/*if(isFull()){
	    System.out.println("Stack over flow");
    	}*/
    	top++;
    	S[top] = x;
    }
    public int pop(){
	/*if(isEmpty()){
	    throw new RuntimeException("Stack under flow");
	}*/
	top--;
	return S[top + 1];
	
    }
    
}
