Problem: There are two (6-sided) dice: a red die and a blue die. When a red die is rolled, it shows i with probability p_i percents, and when a blue die is rolled, it shows j with probability q_j percents.

Petr and tourist are playing the following game. Both players know the probabilistic distributions of the two dice. First, Petr chooses a die in his will (without showing it to tourist), rolls it, and tells tourist the number it shows. Then, tourist guesses the color of the chosen die. If he guesses the color correctly, tourist wins. Otherwise Petr wins.

If both players play optimally, what is the probability that tourist wins the game?

Constraints

* 0 ≤ p_i, q_i ≤ 100
* p_1 + ... + p_6 = q_1 + ... + q_6 = 100
* All values in the input are integers.

Input

The input is given from Standard Input in the following format:


p_1 p_2 p_3 p_4 p_5 p_6
q_1 q_2 q_3 q_4 q_5 q_6


Output

Print the probability that tourist wins. The absolute error or the relative error must be at most 10^{-9}.

Examples

Input

25 25 25 25 0 0
0 0 0 0 50 50


Output

1.000000000000


Input

10 20 20 10 20 20
20 20 20 10 10 20


Output

0.550000000000

Solution (in CPP):

Solution:
#include <iostream>
#include <fstream>
#include <vector>
#include <stack>
#include <queue>
#include <cstring>
#include <cmath>
#include <cstdlib>
#include <cstdio>
#include <algorithm>
#include <unordered_map>
#include <unordered_set>
#include <map>
#include <set>

using namespace std;

typedef long long ll;
typedef pair<int,int> PP;

/*
    freopen("input","r",stdin);
    freopen("output","w",stdout);
*/

int main() {
    ios::sync_with_stdio(false);
    double P[6], Q[6];
    int k;
    for (int i = 0;i < 6;i++) {
        cin >> k;
        P[i] = double(k) / 100.0;
    }
    for (int i = 0;i < 6;i++) {
        cin >> k;
        Q[i] = double(k) / 100.0;
    }
    vector<double> T;
    T.push_back(0.0);
    T.push_back(1.0);
    for (int i = 0;i < 6;i++) {
        if (P[i] == 0.0 || Q[i] == 0.0) continue;
        double r = P[i] / Q[i];
        T.push_back(1.0 / (1.0 + r));
        T.push_back(r / (1.0 + r));
    }
    double sol = 1.0;
    for (int i = 0;i < T.size();i++) {
        double ans = 0.0;
        double p = T[i];
        for (int j = 0;j < 6;j++) {
            ans += max(p * P[j], (1.0 - p) * Q[j]);
        }
        sol = min(sol, ans);
    }
    cout.precision(20);
    cout << sol << endl;
    return 0;
}