#include #include #include #include using namespace std; using namespace atcoder; using ll = long long; //#define endl "\n"; ll N, X, Y, P, Q, R; //行列積 using classMat = double; vector> mat_mul(vector> a, vector> b) { int n = a.size(); vector> res(n, vector(n)); for(int i = 0; i < n; i++){ for(int j = 0; j < n; j++){ for(int k = 0; k < n; k++){ res[i][j] += a[i][k] * b[k][j]; } } } return res; } //行列累乗 vector> mat_pow(vector> a, ll b) { int n = a.size(); vector> res(n, vector(n)); for(int i = 0; i < n; i++) res[i][i] = 1.0; while(b){ if(b & 1) res = mat_mul(res, a); a = mat_mul(a, a); b = (b >> 1); } return res; } int main(){ cin >> N; cin >> X >> Y; cin >> P >> Q >> R; auto f = [&](ll x)->double{ ll takoyaki = X + Y * x; ll l = 1, r = N - x; vector> a = {{1.0 - 1.0 / takoyaki, 1.0}, {0.0, 1.0}}; vector> b = {{(double)0, 0}, {(double)Q, 0}}; while(l < r){ ll m = (l + r) / 2; vector> tc = mat_pow(a, m); vector> tchk = mat_mul(tc, b); if(tchk[0][0] + (Q - R) * takoyaki > Q){ r = m; }else{ l = m + 1; } } vector> c = mat_pow(a, l); vector> chk = mat_mul(c, b); return (double)P * x + ((double)Q - (double)R / takoyaki) * (N - x - l) + chk[0][0]; }; ll l2 = 0, r2 = N - 1; while(r2 - l2 > 2){ ll m1 = (l2 * 2 + r2) / 3; ll m2 = (l2 + r2 * 2) / 3; if(f(m1) < f(m2)) l2 = m1; else r2 = m2; } double ans = 0.0; for(ll i = l2; i <= r2; i++){ ans = max(ans, f(i)); } cout << fixed << setprecision(15) << ans << endl; return 0; }