#include<iostream> #include<cstdio> #include<string> #include<stack> using namespace std; int GetOrder(char x){ if(x=='#'){ return 1; } else if(x=='$'){ return 2; } else if(x=='+'||x=='-'){ return 3; } else{ return 4; } } double GetNumber(int &i,string str){ double number=0; while(str[i]>='0'&&str[i]<='9'){ number=number*10-'0'+str[i++]; } return number; } double CalCulate(double x,double y,char op){ if(op=='+'){ return x+y; } else if(op=='-'){ return x-y; } else if(op=='*'){ return x*y; } else{ return x/y; } } int main(){ string str; while(getline(cin,str)){ if(str=="0"){ break; } stack<double> number; stack<char> operate; operate.push('#'); str+="$"; int i=0; while(i<str.size()){ if(str[i]==' '){ ++i; } else if(str[i]>='0'&&str[i]<='9'){ number.push(GetNumber(i, str)); } else{ if(GetOrder(str[i])>GetOrder(operate.top())){ operate.push(str[i++]); } else{ double y=number.top(); number.pop(); double x=number.top(); number.pop(); number.push(CalCulate(x, y, operate.top())); operate.pop(); } } } printf("%.2f\n",number.top()); } return 0; }