#include #include using namespace atcoder; //#pragma GCC optimize ("O3") using namespace std; #define reps(i,s,n) for(int i = s; i < n; i++) #define rep(i,n) reps(i,0,n) #define Rreps(i,n,e) for(int i = n - 1; i >= e; --i) #define Rrep(i,n) Rreps(i,n,0) #define ALL(a) a.begin(), a.end() using ll = long long; using vec = vector; using mat = vector; ll N,M,H,W,Q,K,A,B; string S; using P = pair; using tp = tuple; const ll INF = (1LL<<60); template bool chmin(T &a, const T b){ if(a > b) {a = b; return true;} else return false; } template bool chmax(T &a, const T b){ if(a < b) {a = b; return true;} else return false; } template void my_printv(std::vector v,bool endline = true){ if(!v.empty()){ for(std::size_t i{}; i; int main() { cin.tie(nullptr); ios::sync_with_stdio(false); ll C; cin>>A>>B>>C>>N; vector> dp((A + 1) * (B + 1) * (C + 1) * (N + 1), {-1, -1, -1}); auto toid = [&C](int a, int b, int c, int n){ return ((a * (B + 1) + b) * (C + 1) + c) * (N + 1) + n; }; auto add = [](tuple a, tuple b) -> tuple{ return {get<0>(a) + get<0>(b), get<1>(a) + get<1>(b), get<2>(a) + get<2>(b)}; }; auto dfs = [&](auto &&self, int a, int b, int c, int n) -> tuple{ int id = toid(a, b, c, n); if(get<0>(dp[id]) > -1e-9) return dp[id]; auto &res = dp[id]; res = {0.0, 0.0, 0.0}; if(n == 0 || a + b + c <= 1){ res = {A - a, B - b, C - c}; }else{ int s = a + b + c; double tot = 1.0; rep(i, 3){ int k = a; if(i == 1) k = b; else if(i == 2) k = c; if(k == 0) continue; double p = (double)k * (k - 1) / (s * (s - 1)); tot -= p; auto [na, nb, nc] = self(self, a - (i == 0), b - (i == 1), c - (i == 2), n - 1); res = add(res, tuple(na * p, nb * p, nc * p)); } assert(tot >= -1e-9); auto [na, nb, nc] = self(self, a, b, c, n - 1); res = add(res, tuple(na * tot, nb * tot, nc * tot)); } return res; }; auto [a, b, c] = dfs(dfs, A, B, C, N); cout<