#include <bits/stdc++.h>
#define MP make_pair
#define PB push_back
#define int long long
#define st first
#define nd second
#define rd third
#define FOR(i, a, b) for(int i =(a); i <=(b); ++i)
#define RE(i, n) FOR(i, 1, n)
#define FORD(i, a, b) for(int i = (a); i >= (b); --i)
#define REP(i, n) for(int i = 0;i <(n); ++i)
#define VAR(v, i) __typeof(i) v=(i)
#define FORE(i, c) for(VAR(i, (c).begin()); i != (c).end(); ++i)
#define ALL(x) (x).begin(), (x).end()
#define SZ(x) ((int)(x).size())
using namespace std;
template<typename TH> void _dbg(const char* sdbg, TH h) { cerr<<sdbg<<"="<<h<<"\n"; }
template<typename TH, typename... TA> void _dbg(const char* sdbg, TH h, TA... t) {
while(*sdbg != ',')cerr<<*sdbg++; cerr<<"="<<h<<","; _dbg(sdbg+1, t...);
}
#ifdef LOCAL
#define debug(...) _dbg(#__VA_ARGS__, __VA_ARGS__)
#define debugv(x) {{cerr <<#x <<" = "; FORE(itt, (x)) cerr <<*itt <<", "; cerr <<"\n"; }}
#else
#define debug(...) (__VA_ARGS__)
#define debugv(x)
#define cerr if(0)cout
#endif
#define make(type, x) type x; cin>>x;
#define make2(type, x, y) type x, y; cin>>x>>y;
#define make3(type, x, y, z) type x, y, z; cin>>x>>y>>z;
#define make4(type, x, y, z, t) type x, y, z, t; cin>>x>>y>>z>>t;
#define next ____next
#define prev ____prev
#define left ____left
#define hash ____hash
typedef long long ll;
typedef long double LD;
typedef pair<int, int> PII;
typedef pair<ll, ll> PLL;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<ll> VLL;
typedef vector<pair<int, int> > VPII;
typedef vector<pair<ll, ll> > VPLL;
template<class C> void mini(C&a4, C b4){a4=min(a4, b4); }
template<class C> void maxi(C&a4, C b4){a4=max(a4, b4); }
template<class T1, class T2>
ostream& operator<< (ostream &out, pair<T1, T2> pair) { return out << "(" << pair.first << ", " << pair.second << ")";}
template<class A, class B, class C> struct Triple { A first; B second; C third;
bool operator<(const Triple& t) const { if (st != t.st) return st < t.st; if (nd != t.nd) return nd < t.nd; return rd < t.rd; } };
template<class T> void ResizeVec(T&, vector<int>) {}
template<class T> void ResizeVec(vector<T>& vec, vector<int> sz) {
vec.resize(sz[0]); sz.erase(sz.begin()); if (sz.empty()) { return; }
for (T& v : vec) { ResizeVec(v, sz); }
}
typedef Triple<int, int, int> TIII;
template<class A, class B, class C>
ostream& operator<< (ostream &out, Triple<A, B, C> t) { return out << "(" << t.st << ", " << t.nd << ", " << t.rd << ")"; }
template<class T> ostream& operator<<(ostream& out, vector<T> vec) { out<<"("; for (auto& v: vec) out<<v<<", "; return out<<")"; }
const int N = 1e4 + 5;
LD p[N];
LD dp[2][N][7];
#undef int
int main() {
#define int long long
ios_base::sync_with_stdio(0);
cout << fixed << setprecision(10);
cerr << fixed << setprecision(10);
cin.tie(0);
//double beg_clock = 1.0 * clock() / CLOCKS_PER_SEC;
LD E1 = 0;
RE (i, 6) {
cin>>p[i];
E1 += i * p[i];
dp[0][i][i] = p[i];
}
int n;
cin>>n;
LD V1 = 0;
RE (i, 6) {
LD diff = i - E1;
V1 += diff * diff * p[i];
}
debug(E1, V1);
int cap = min(n, (int)1500);
int cur = 1;
RE (i, cap - 1) {
debug(i);
RE (sum, 6 * i) {
RE (last, 6) {
dp[cur][sum][last] = 0;
}
}
RE (sum, 6 * i) {
RE (last, 6) {
RE (now, 6) {
if (now != last) {
dp[cur][sum + now][now] += dp[cur ^ 1][sum][last] * p[now] / (1 - p[last]);
}
}
}
}
cur ^= 1;
}
LD E[2], V[2];
REP (tr, 2) {
E[tr] = V[tr] = 0;
RE (sum, 6 * cap) {
RE (last, 6) {
E[tr] += dp[tr][sum][last] * sum;
}
}
RE (sum, 6 * cap) {
RE (last, 6) {
LD diff = sum - E[tr];
V[tr] += diff * diff * dp[tr][sum][last];
}
}
}
if (E[0] > E[1]) {
swap(E[0], E[1]);
swap(V[0], V[1]);
}
LD resE = (n - cap) * (E[1] - E[0]) + E[1];
LD resV = (n - cap) * (V[1] - V[0]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2ICogaSkgewogICAgICBSRSAobGFzdCwgNikgewogICAgICAgIGRwW2N1cl1bc3VtXVtsYXN0XSA9IDA7CiAgICAgIH0KICAgIH0KICAgIFJFIChzdW0sIDYgKiBpKSB7CiAgICAgIFJFIChsYXN0LCA2KSB7CiAgICAgICAgUkUgKG5vdywgNikgewogICAgICAgICAgaWYgKG5vdyAhPSBsYXN0KSB7CiAgICAgICAgICAgIGRwW2N1cl1bc3VtICsgbm93XVtub3ddICs9IGRwW2N1ciBeIDFdW3N1bV1bbGFzdF0gKiBwW25vd10gLyAoMSAtIHBbbGFzdF0pOwogICAgICAgICAgfQogICAgICAgIH0KICAgICAgfQogICAgfQogICAgY3VyIF49IDE7CiAgfQogIExEIEVbMl0sIFZbMl07CiAgUkVQICh0ciwgMikgewogICAgRVt0cl0gPSBWW3RyXSA9IDA7CiAgICBSRSAoc3VtLCA2ICogY2FwKSB7CiAgICAgIFJFIChsYXN0LCA2KSB7CiAgICAgICAgRVt0cl0gKz0gZHBbdHJdW3N1bV1bbGFzdF0gKiBzdW07CiAgICAgIH0KICAgIH0KICAgIFJFIChzdW0sIDYgKiBjYXApIHsKICAgICAgUkUgKGxhc3QsIDYpIHsKICAgICAgICBMRCBkaWZmID0gc3VtIC0gRVt0cl07CiAgICAgICAgVlt0cl0gKz0gZGlmZiAqIGRpZmYgKiBkcFt0cl1bc3VtXVtsYXN0XTsKICAgICAgfQogICAgfQogIH0KICBpZiAoRVswXSA+IEVbMV0pIHsKICAgIHN3YXAoRVswXSwgRVsxXSk7CiAgICBzd2FwKFZbMF0sIFZbMV0pOwogIH0KICBMRCByZXNFID0gKG4gLSBjYXApICogKEVbMV0gLSBFWzBdKSArIEVbMV07CiAgTEQgcmVzViA9IChuIC0gY2FwKSAqIChWWzFdIC0gVlswXSkgKyBWWzFdOwogIGNvdXQ8PHJlc0U8PCJcbiI8PHJlc1Y8PCJcbiI7CiAgICAKICAKICAKICAKICAKICAKICAKICAKICAKICAKICAKICAKICAKICAKICAKICAKICAKICAKICAKICAKICAKICAKICAKICByZXR1cm4gMDsKfQo=