#include<iostream>
#include<cstdio>
#include<string>
using namespace std;
#include<stack>
#include<queue>
#include<map>
struct node{
double num;
char op;
bool flag;
};
string str;
stack<node>s;
queue<node>q;
map<char, int>op;
void Change(){
double num;
node temp,temp1;
for (int i = 0; i < str.length();){
if (str[i] == '('){
temp1.op = str[i];
s.push(temp1);
i++;
}
else if (str[i] == ')'){
while (s.top().op != '('){
q.push(s.top());
s.pop();
}
s.pop();
i++;
}
else if (str[i] >= '0'&&str[i] <= '9'){
temp.flag = true;
temp.num = str[i++] - '0';
while (i<str.length()&&str[i]>='0'&&str[i]<='9'){
temp.num = temp.num * 10 + (str[i] - '0');
i++;
}
q.push(temp);
}
else{
temp.flag = false;
while (!s.empty() && op[str[i]] <= op[s.top().op] && s.top().op != '('){
q.push(s.top());
s.pop();
}
temp.op = str[i];
s.push(temp);
i++;
}
}
while (!s.empty()){
q.push(s.top());
s.pop();
}
}
double calculator(){
node cur; node temp; double temp1, temp2;
while (!q.empty()){
cur = q.front();
q.pop();
if (cur.flag == true) s.push(cur);
else{
temp2 = s.top().num;
s.pop();
temp1 = s.top().num;
s.pop();
temp.flag = true;
if (cur.op =='+')temp.num= temp1 + temp2;
else if (cur.op == '-')temp.num = temp1 - temp2;
else if (cur.op =='*')temp.num = temp1*temp2;
else temp.num = temp1 / temp2;
s.push(temp);
}
}
return s.top().num;
}
int main(){
op['+'] = op['-'] = 1;
op['*'] = op['/'] = 2; op['('] = op[')'] = 3;
while (getline(cin, str), str != "0"){
for (string::iterator it = str.begin(); it != str.end(); it++){
if (*it == ' ')str.erase(it);
}
while (!s.empty())s.pop();
Change();
/* while (!q.empty()){
if (q.front().flag == true)cout << q.front().num;
else cout << q.front().op;
q.pop();
}*/
printf("%.2f\n", calculator());
}
return 0;
}
08-14
1155
03-31
3855
07-25
1349
07-24
4120
07-25
1151
07-23
1310