#include <cstdio>
#include <string>
#include <iostream>
#include <stack>
#include <queue>
#include <map>
using namespace std;
bool isop(char c){
if(c=='+' || c=='*' || c=='-' || c=='/') return true;
return false;
}
struct Node{
double num;
char op;
bool flag;
};
stack<Node> st;
queue<Node> q;
map<char,int> m;
string str;
void change(){
Node node;
for(int i=0; i<str.size();){
if(str[i]<='9' && str[i]>='0'){
node.flag = 1;
node.num = str[i] - '0';
i++;
while(i<str.size() && str[i]<='9' && str[i]>='0'){
node.num = node.num*10 + (str[i]-'0');
i++;
}
q.push(node);
}else{
node.flag = 0;
node.op = str[i];
while(!st.empty() && m[node.op]<=m[st.top().op]){
q.push(st.top());
st.pop();
}
st.push(node);
i++;
}
}
while(!st.empty()){
q.push(st.top());
st.pop();
}
}
double cal(){
double temp1;
double temp2;
Node res;
res.flag = 1;
while(!q.empty()){
Node node = q.front();
q.pop();
if(node.flag){
st.push(node);
}else{
temp2 = st.top().num;
st.pop();
temp1 = st.top().num;
st.pop();
if(node.op == '+'){
res.num = temp1 + temp2;
}else if(node.op == '-'){
res.num = temp1 - temp2;
}else if(node.op == '*'){
res.num = temp1 * temp2;
}else if(node.op == '/'){
res.num = temp1 / temp2;
}
st.push(res);
}
}
return st.top().num;
}
int main(){
m['-'] = 0;
m['+'] = 0;
m['*'] = 1;
m['/'] = 1;
while(getline(cin, str), str!="0"){
for(string::iterator it=str.begin(); it!=str.end(); it++){
if(*it == ' ') str.erase(it);
}
while(!st.empty()){
st.pop();
}
change();
// while(!q.empty()){
// if(q.front().flag){
// printf("%.0f", q.front().num);
// }else{
// printf("%c", q.front().op);
// }
// q.pop();
// }
printf("%.2f\n", cal());
}
return 0;
}
写了好久,好难好难好难QAQ