#include <iostream> #include <stack> #include <unordered_map> using namespace std; unordered_map<char, int> pr{{'+', 1}, {'-', 1}, {'*', 2}, {'/', 2}}; stack<double> num; stack<char> op; void eval(){ double x; double b = num.top(); num.pop(); double a = num.top(); num.pop(); char c = op.top(); op.pop(); if(c == '+') x = a + b; else if(c == '-') x = a - b; else if(c == '*') x = a * b; else x = a / b; num.push(x); } int main(){ string s; while(getline(cin, s)){ if(s == "0") break; while(num.size()) num.pop(); for(int i = 0; i < s.size(); i ++){ if(isdigit(s[i])){ int j = i; double x = 0; while(isdigit(s[j]) && j < s.size()){ x = x * 10 + s[j] - '0'; j ++; } i = j; num.push(x); }else if(s[i] != ' '){ while(op.size() && pr[op.top()] >= pr[s[i]]) eval(); op.push(s[i]); } } while(op.size()) eval(); printf("%.2lf\n", num.top()); } }