#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){
int resp;
double x, a1, a2;
switch(resp){
case 1:
if(!isEmpty()){
x = pop() + pop();
push(x);
}
break;
case 2:
if(!isEmpty()){
a1=pop(); a2=pop();
x = a2 - a1;
push(x);
}
break;
case 3:
if(!isEmpty()){
x = pop() * pop();
push(x);
}
break;
case 4:
if(!isEmpty()){
a1=pop(); a2=pop();
x = a2 / a1;
push(x);
}
break;
case 5:
push(x);
break;
case 9:
answer();
return 0;
}
}
answer();
return 0;
}
void push(double value)
{
if( isFull() ){
}else{
stack[sp++] = value;
}
}
double pop(void)
{
if( isEmpty() ){
printf("スタックが空で取り出せませんでした\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())
}
void reset(void)
{
sp = 0;
}
I2luY2x1ZGUgPHN0ZGlvLmg+CgojZGVmaW5lIFNJWkUgMTAKZG91YmxlIHN0YWNrW1NJWkVdOwppbnQgc3A7Cgp2b2lkIHB1c2goZG91YmxlIHZhbHVlKTsKZG91YmxlIHBvcCh2b2lkKTsKaW50IGlzRnVsbCh2b2lkKTsKaW50IGlzRW1wdHkodm9pZCk7CnZvaWQgYW5zd2VyKHZvaWQpOwp2b2lkIHJlc2V0KHZvaWQpOwoKaW50IG1haW4odm9pZCkKewogIHJlc2V0KCk7CiAgCiAgd2hpbGUoMSl7CiAgICBpbnQgcmVzcDsKICAgIGRvdWJsZSB4LCBhMSwgYTI7CglzY2FuZigiJWQiLCZyZXNwKTsKCQogICAgc3dpdGNoKHJlc3ApewogICAgICBjYXNlIDE6CiAgICAgICAgaWYoIWlzRW1wdHkoKSl7CiAgICAgICAgICB4ID0gcG9wKCkgKyBwb3AoKTsKICAgICAgICAgIHB1c2goeCk7CiAgICAgICAgfQogICAgICAgIGJyZWFrOwogICAgICBjYXNlIDI6CiAgICAgICAgaWYoIWlzRW1wdHkoKSl7CiAgICAgICAgICBhMT1wb3AoKTsgYTI9cG9wKCk7CiAgICAgICAgICB4ID0gYTIgLSBhMTsKICAgICAgICAgIHB1c2goeCk7CiAgICAgICAgfQogICAgICAgIGJyZWFrOwogICAgICBjYXNlIDM6CiAgICAgICAgaWYoIWlzRW1wdHkoKSl7CiAgICAgICAgICB4ID0gcG9wKCkgKiBwb3AoKTsKICAgICAgICAgIHB1c2goeCk7CiAgICAgICAgfQogICAgICAgIGJyZWFrOwogICAgICBjYXNlIDQ6CiAgICAgICAgaWYoIWlzRW1wdHkoKSl7CiAgICAgICAgICBhMT1wb3AoKTsgYTI9cG9wKCk7CiAgICAgICAgICB4ID0gYTIgLyBhMTsKICAgICAgICAgIHB1c2goeCk7CiAgICAgICAgfQogICAgICAgIGJyZWFrOwogICAgICBjYXNlIDU6CiAgICAgICAgc2NhbmYoIiVsZiIsJngpOwogICAgICAgIHByaW50ZigiZGF0YTolbGZcbiIseCk7CiAgICAgICAgcHVzaCh4KTsKICAgICAgICBicmVhazsKICAgICAgY2FzZSA5OgogICAgCWFuc3dlcigpOwogICAgICAgIHJldHVybiAwOwogICAgfQogIH0KICAKICBhbnN3ZXIoKTsKICAKICByZXR1cm4gMDsKfQoKdm9pZCBwdXNoKGRvdWJsZSB2YWx1ZSkKewogIGlmKCBpc0Z1bGwoKSApewogICAgcHJpbnRmKCLjgrnjgr/jg4Pjgq/jgYzmuoDmna/jgaflhaXjgorjgb7jgZvjgpPjgafjgZfjgZ9cbiIpOwogIH1lbHNlewogICAgc3RhY2tbc3ArK10gPSB2YWx1ZTsKICB9Cn0KCmRvdWJsZSBwb3Aodm9pZCkKewogIGlmKCBpc0VtcHR5KCkgKXsKICAgIHByaW50Zigi44K544K/44OD44Kv44GM56m644Gn5Y+W44KK5Ye644Gb44G+44Gb44KT44Gn44GX44GfXG4iKTsKICAgIHJldHVybiAwOwogIH1lbHNlewogICAgcmV0dXJuIHN0YWNrWy0tc3BdOwogIH0KfQoKaW50IGlzRnVsbCh2b2lkKQp7CiAgaWYoc3AgPj0gU0laRSl7CiAgICByZXR1cm4gMTsKICB9ZWxzZXsKICAgIHJldHVybiAwOwogIH0KfQoKaW50IGlzRW1wdHkodm9pZCkKewogIGlmKHNwIDw9IDApewogICAgcmV0dXJuIDE7CiAgfWVsc2V7CiAgICByZXR1cm4gMDsKICB9Cn0KCnZvaWQgYW5zd2VyKHZvaWQpCnsKICBpZighaXNFbXB0eSgpKQoJcHJpbnRmKCJhbnN3ZXI6JWxmIixwb3AoKSk7Cn0KCnZvaWQgcmVzZXQodm9pZCkKewogIHNwID0gMDsKfQ==