#include <stdio.h>
#define STACK_SIZE 100

int stack[STACK_SIZE];
int stack_size = 0;

int pop()
{
	if (stack_size <= 0) return 0;
	return stack[--stack_size];
}

int push(int a)
{
	stack[stack_size++] = a;
}

int calc(char *s)
{
	int a, b, type;
	while (*s) {
		switch(*s) {
		case ' ':
			break;
		case '+':
			a = pop();
			b = pop();
			push(b+a);
			break;
		case '-':
			a = pop();
			b = pop();
			push(b-a);
			break;
		case '*':
			a = pop();
			b = pop();
			push(b*a);
			break;
		case '/':
			a = pop();
			b = pop();
			if (a == 0) break;
			push(b/a);
			break;
		case '%':
			a = pop();
			b = pop();
			if (a == 0) break;
			push(b%a);
			break;
		default:
			push(*s - '0');
		}
		s++;
	}
	return pop();
}

int main()
{
	char s[100];
	scanf("%[^\n]*s", s);
	printf("%s = %d\n", s, calc(s));
}