
#include <stdio.h>

#define SIZE 10

double stack[SIZE];
int sp;

void push(double value);
double pop(void);
int isFull(void);
int isEmpty(void);
void answer(void);
void reset(void);

int main(void)
{
    int resp;
    double data, cal1, cal2;

    reset();

    while(1){
        if(scanf("%d", &resp) != 1) break;

        if(resp == 9) break;

        switch(resp){
            case 1:
                cal1 = pop();
                cal2 = pop();
                push(cal2 + cal1);
                break;

            case 2:
                cal1 = pop();
                cal2 = pop();
                push(cal2 - cal1);
                break;

            case 3:
                cal1 = pop();
                cal2 = pop();
                push(cal2 * cal1);
                break;

            case 4:
                cal1 = pop();
                cal2 = pop();
                push(cal2 / cal1);
                break;

            case 5:
                if(scanf("%lf", &data) != 1) return 1;
                printf("data:%f\n", data);
                push(data);
                break;
        }
    }

    answer();

    return 0;
}

void push(double value)
{
    if(isFull()){
        printf("stack is full\n");
    }
    else{
        stack[sp++] = value;
    }
}

double pop(void)
{
    if(isEmpty()){
        printf("stack is empty\n");
        return 0;
    }
    else{
        return stack[--sp];
    }
}

int isFull(void)
{
    if(sp >= SIZE){
        return 1;
    }
    else{
        return 0;
    }
}

int isEmpty(void)
{
    if(sp <= 0){
        return 1;
    }
    else{
        return 0;
    }
}

void answer(void)
{
    if(!isEmpty()){
        printf("\nanswer:%f\n", pop());
    }
    else{
        printf("stack is empty\n");
    }
}

void reset(void)
{
    sp = 0;
}
