func_code_string: #include<bits/stdc++.h>   #define pb(x) push_back(x)   #define all(x) x.begin(), x.end()   #define N 200005   #define FIFO ios::sync_with_stdio(false)   #define cout3(x, y, z) cout << x <<     << y <<     << z << endl   #define cout2(x, y) cout << x <<     << y << endl   #define INF (1<<30)   #define MOD 1000000007   #define ones(x) __builtin_popcountll(x)   #define EPS 1e-6      using namespace std;      long double v;   map<pair<long double, long double>, long double>memo;      long double DP(long double c, long double m, long double p){        //cout3(c, m, p);    if(c < EPS && m < EPS)return p;    if(memo.find(make_pair(c, m)) != memo.end())return memo[make_pair(c, m)];        long double ans = 0;    //chosing c    if(c > EPS){          if(c + EPS <= v){            if(m > EPS)ans += c * (1 + DP(0, m + c/2., p + c/2.));       else ans += c * (1 + DP(0, m, p + c));     }     else{            if(m > EPS)ans += c * (1 + DP(c - v, m + v/2, p + v/2));      else ans += c * (1 + DP(c - v, m, p + v));      }    }        if(m > EPS){     if(m + EPS <= v){            if(c > EPS)ans += m * (1 + DP(c + m/2, 0, p + m/2));      else ans += m * (1 + DP(c, 0, p + m));     }     else{            if(c > EPS)ans += m * (1 + DP(c + v/2, m - v, p + v/2));      else ans += m * (1 + DP(c, m - v, p + v));      }    }        if(p > EPS)ans += p;         return memo[make_pair(c, m)] = ans;       }            //string cases[7] = { 2 ,  02 ,  012 ,  0112 ,  12 ,  102 ,  1002 };      int main(){       FIFO;       int tc = 0;    cin >> tc;       while(tc--){        long double c, m, p, ans = 0;        cin >> c >> m >> p >> v;     memo.clear();          cout << fixed << setprecision(6) << DP(c, m, p) << endl;            /*     for(int i = 0; i < 7; i++){            double curProp[] = {c, m, p};      bool ok = true;      double prop = 1.0;            for(int j = 0, id; j < cases[i].size() && ok; j++){              id = cases[i][j] -  0 ;       if(curProp[id] == 0)ok = false;       else{                prop *= curProp[id];        if(curProp[id] <= v){                  vector<int>candidates;         int len = 0;                  for(int l = 0; l < 3; l++)if(l != id && curProp[l] != 0)candidates.pb(l);                  len = candidates.size();         double add = curProp[id]/len;         for(int l = 0; l < candidates.size(); l++)curProp[candidates[l]] += add;                  curProp[id] = 0;        }        else{                   vector<int>candidates;         int len = 0;                  for(int l = 0; l < 3; l++)if(l != id && curProp[l] != 0)candidates.pb(l);                  len = candidates.size();         double add = v/len;         for(int l = 0; l < candidates.size(); l++)curProp[candidates[l]] += add;                  curProp[id] -= v;        }       }              //for(int l = 0; l < 3; l++)cout  << curProp[l] <<    ;       //cout << endl;      }            //cout2(ok, prop);      if(ok)ans += prop * cases[i].size();      }               cout << ans << endl;        */    }         }   