#include<bits/stdc++.h>
#define file "gtbt"
using namespace std;
#define int long long
#define ld long double
#define pii pair<int,int>
#define pb push_back
#define mp make_pair
#define X first
#define Y second
#define lb lower_bound
#define ub upper_bound
#define all(x) x.begin(), x.end()
#define sz(x) x.size()
const int N=1e6+5;
const int NN=1e3+9;
const int MOD=1e9+7;
const int dx[4]={0, -1, 0, 1};
const int dy[4]={-1, 0, 1, 0};
const int INF=1e18;
const ld eps=1e-6;
const ld pi=acos(-1.0); // 48 digits
string s;
int weight(char kt) {
if (kt=='^') return 3;
if (kt=='*' || kt=='/') return 2;
if (kt=='+' || kt=='-') return 1;
return 0;
}
bool isOp(char kt) {
return kt=='^' || kt=='*' || kt=='/' ||
kt=='+' || kt=='-';
}
// Chuyen trung to sang hau to
vector<string> solve(string sth) {
sth='('+sth+')';
stack<char> st;
vector<string> res;
string num="";
for (int i=0;i<sz(sth);i++) {
char c=sth[i];
if (c==' ') continue;
// cout<<c<<endl;
if ('0'<=c && c<='9')
num+=c;
else {
if (!sz(num)==0) {
res.pb(num);
num="";
}
if (c=='(')
st.push(c);
else if (c==')') {
while (!st.empty() && st.top()!='(') {
res.pb(string(1,st.top()));
st.pop();
}
if (!st.empty())
st.pop();
}
else if (isOp(c)) {
if (c=='-' && sth[i-1]=='(' && st.top()=='(')
num+='-';
else {
while (!st.empty() && isOp(st.top()) && // check stack ko rong hoac st.top != '('
(weight(st.top())>weight(c) ||
(weight(st.top())==weight(c) && c!='^'))) {// a^b^c => a^(b^c) chu khong phai (a^b)^c
res.pb(string(1,st.top()));
st.pop();
}
st.push(c);
}
}
}
}
return res;
}
int to_num(string s) {
int res=0;
int start;
start=(s[0]=='-' ? 1 : 0);
for (int i=start;i<sz(s);i++)
res=res*10+(s[i]-'0');
return (start ? -res : res);
}
double calc(vector<string> v) {
if (sz(v)==1) return to_num(v[0]);
vector<double> st;
for (int i=0;i<sz(v);i++) {
string t=v[i];
if (isOp(t[0]) && sz(t)==1) {
double a, b;
// cout<<sz(st)<<endl;
// for (int x : st)
// cout<<x<<" ";
// cout<<endl;
b=st.back();
st.pop_back();
a=st.back();
st.pop_back();
if (t[0]=='+') st.pb(a+b);
if (t[0]=='-') st.pb(a-b);
if (t[0]=='*') st.pb(a*b);
if (t[0]=='/') st.pb(a/b);
if (t[0]=='^') st.pb(pow(a,b));
}
else {
int num=to_num(t);
st.pb(num);
}
}
return st.back();
}
void process() {
// Code here :V
cout<<setprecision(6)<<fixed;
getline(cin,s);
int i=0;
while (i<sz(s)) {
if (s[i]==' ') s.erase(i,1);
else i++;
}
vector<string> t=solve(s);
// for (int i=0;i<sz(t);i++)
// cout<<t[i]<<" ";
// cout<<endl;
cout<<calc(t);
}
signed main() {
cin.tie(0)->sync_with_stdio(0);
// freopen(file".inp","r",stdin);
// freopen(file".out","w",stdout);
int t=1;
// cin>>t;
while (t--) process();
return 0;
}