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

// #define DEBUG

struct Node;
typedef 
struct Node *point;
typedef point Stack;

struct Node
{
   
int num;
   point next;
       }
 ;
        
Stack CreatStack();
void Push(int,Stack);
void Pop(Stack);
void MakeEmpty(Stack);
int IsEmpty(Stack);
int Top(Stack);

int main()
{
    
char cha;
    
int tmpNum1,tmpNum2;
    Stack s
=CreatStack();
    
while(scanf("%c",&cha)!=EOF)
    
{
       
if(cha=='\n'{printf("%d\n",Top(s)); MakeEmpty(s); continue;}
       
if(cha>47&&cha<58)
          Push(cha
%48,s);
       
else
       
{
          
switch (cha)
          
{
             
case '+': tmpNum1=Top(s);
                       Pop(s);
                       tmpNum2
=Top(s);
                       Pop(s);
                       Push(tmpNum2
+tmpNum1,s);
                       #ifdef DEBUG
                           printf(
"%d\n",tmpNum2+tmpNum1);
                                         
#endif
                        
break;
             
case '-': tmpNum1=Top(s);
                       Pop(s);
                       tmpNum2
=Top(s);
                       Pop(s);
                       Push(tmpNum2
-tmpNum1,s);
                       #ifdef DEBUG
                           printf(
"%d\n",tmpNum2-tmpNum1);
                                         
#endif
                       
break;
             
case '*': tmpNum1=Top(s);
                       Pop(s);
                       tmpNum2
=Top(s);
                       Pop(s);
                       Push(tmpNum2
*tmpNum1,s);
                       #ifdef DEBUG
                           printf(
"%d\n",tmpNum2*tmpNum1);
                                         
#endif 
                       
break;
             
case '/': tmpNum1=Top(s);
                       Pop(s);
                       tmpNum2
=Top(s);
                       Pop(s);
                       Push(tmpNum2
/tmpNum1,s);
                       #ifdef DEBUG
                               printf(
"%d\n",tmpNum2/tmpNum1);
                                             
#endif
                       
break;
          }

       }

    }

    system(
"pause");
    
return 0;
}