#include<iostream.h>

void push(int stack[], int &top, int x){

      stack[top++]=x;}//PUSH

int pop(int stack[], int &top){

      return stack[--top]; }//POP

int evaluate(int num1, int num2, char t){

      switch(t){

            case'+': return num2+num1; break;

            case'-': return num2-num1; break;

            case'/': return num2/num1; break;

            case'*': return num2*num1; break;

      }//SWITCH

}//EVALUATE

int main(){

      int stack[10], top=0, x, num1, num2, value;

      char t;

      cout<<"PLEASE ENTER A POSTFIX NOTATION"<<endl;

      while(cin.get(t)){

            if ((t>='0')&&(t<='9')){

                  cin.putback(t);

                  cin>>x;

                  push(stack, top, x);}//IF

            else if ((t=='+')||(t=='-')||(t=='/')||(t=='*')){

                  num1=pop(stack, top);

                  num2=pop(stack, top);

                  value=evaluate(num1, num2, t);

                  push(stack, top, value);

            }//ELSE IF

            if(t=='\n')break;

      }//WHILE

      cout<<pop(stack, top);

}//MAIN

1