#include <stdio.h>
#include <string.h>
#include <stdlib.h>
struct stack
{
int data;
struct stack* next;
};
void initstack(struct stack** L)
{
*L = (struct stack*)malloc(sizeof(struct stack));
(*L)->next = NULL;
}
void push(struct stack** L, int e)
{
struct stack* s = (struct stack*)malloc(sizeof(struct stack));
s->data = e;
s->next = *L;
*L = s;
}
int top(struct stack** L)
{
struct stack* p, * s;
s = *L;
p = *L;
int e;
e = (*L)->data;
p = (*L)->next;
*L = p;
s->next = NULL;
free(s);
return e;
}
int main()
{
char *a;
a = (char*)malloc(50*sizeof(char));
struct stack* L;
initstack(&L);
int num = 0, count = 0;
scanf("%s", a);
int len_a, n, m;
n = 0;
m = 0;
len_a = strlen(a);
for (int i = 0; i < len_a; i++)
{
switch (a[i])
{
case '.':
push(&L, num);
num = 0;
break;
case '+':
count = top(&L) + top(&L);
push(&L, count);
break;
case '-':
count = (-1) * (top(&L) - top(&L));
push(&L, count);
break;
case '*':
count = top(&L) * top(&L);
push(&L, count);
break;
case '/':
n = top(&L);
m = top(&L);
count = m / n;
push(&L, count);
break;
case '@':
break;
default:
num = num * 10 + (a[i] - '0');
}
n = 0;
m = 0;
count = 0;
}
free(a);
printf("%d", top(&L));
}