#include <stdio.h>
#include <stdlib.h>
#include <ctype.h>

void print(int *, int n);
int calc(int *, char, int );
int main(void){
	int arr[100],n=0,f=1;
	char data;
	while((data = getchar()) != '\n'){
		if(data == ' ') f=1;

		else if(isdigit(data)){
			arr[n] = atoi(&data);
			f=1;
			while(((data = getchar()) != '\n') && data !=' '){
				f*=10;		
				arr[n] +=atoi(&data)*f;
			}
			n++;
		}
		
		else{
			f=1;
			n = calc(arr,data,n);
		}
	}
	printf("%d\n",arr[n-1]);
		
}
	
int calc(int *_arr, char data, int n){
	int tmp;
		if(data == '+'){
			tmp = _arr[n-2] + _arr[n-1];
			_arr[n-2] = tmp;
		}	
		else if(data == '-'){
			tmp = _arr[n-2] - _arr[n-1];
			_arr[n-2] = tmp;
		}	
		else if(data == '*'){
			tmp = _arr[n-2] * _arr[n-1];
			_arr[n-2] = tmp;
		}
		else if(data == '/'){
			tmp = _arr[n-2] / _arr[n-1];
			_arr[n-2] = tmp;
		}
	return n-1;
}