#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) 
{
    reset();
    
	while(1){
	double cal1,cal2,data;
	int resp;
	scanf("%d",&resp);
		
		switch(resp){
			case 1: cal2 = pop();
			        cal1 = pop(); 
			        push(cal1+cal2);
			        break;
			case 2: cal2 = pop();
			        cal1 = pop(); 
			        push(cal1-cal2);
			        break;
			case 3: cal2 = pop();
			        cal1 = pop(); 
			        push(cal1*cal2);
			        break;
			case 4: cal2 = pop();
			        cal1 = pop(); 
			        push(cal1/cal2);
			        break;
			case 5: printf("push : ");
			        scanf("%lf",&data);
			        push( data );
			        break;
			case 9: answer();
			        return 0;
		   default: return 0;       
		}
		printf("sp=%d\n", sp);
		
	}
	
	answer();
	
	return 0;
}

void push(double value)
{
	if(isFull()){
		printf("このスタックは満杯です");
	}else{
		stack[sp++]=value;
	}
}

double pop(void)
{
	if(isEmpty()){
	   printf("このスタックは空です");
	}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)
{
    printf("\n");
	for(int i=0; i<sp; i++){
		printf("stack[%d]=%f\n", i, stack[i]);
	}	
}

void reset(void){
	sp=0;
}

