Problem: Gosha is hunting. His goal is to catch as many Pokemons as possible. Gosha has a Poke Balls and b Ultra Balls. There are n Pokemons. They are numbered 1 through n. Gosha knows that if he throws a Poke Ball at the i-th Pokemon he catches it with probability pi. If he throws an Ultra Ball at the i-th Pokemon he catches it with probability ui. He can throw at most one Ball of each type at any Pokemon.

The hunting proceeds as follows: at first, Gosha chooses no more than a Pokemons at which he will throw Poke Balls and no more than b Pokemons at which he will throw Ultra Balls. After that, he throws the chosen Balls at the chosen Pokemons. If he throws both Ultra Ball and Poke Ball at some Pokemon, he is caught if and only if he is caught by any of these Balls. The outcome of a throw doesn't depend on the other throws.

Gosha would like to know what is the expected number of the Pokemons he catches if he acts in an optimal way. In other words, he would like to know the maximum possible expected number of Pokemons can catch.

Input

The first line contains three integers n, a and b (2 ≤ n ≤ 2000, 0 ≤ a, b ≤ n) — the number of Pokemons, the number of Poke Balls and the number of Ultra Balls.

The second line contains n real values p1, p2, ..., pn (0 ≤ pi ≤ 1), where pi is the probability of catching the i-th Pokemon if Gosha throws a Poke Ball to it.

The third line contains n real values u1, u2, ..., un (0 ≤ ui ≤ 1), where ui is the probability of catching the i-th Pokemon if Gosha throws an Ultra Ball to it.

All the probabilities are given with exactly three digits after the decimal separator.

Output

Print the maximum possible expected number of Pokemons Gosha can catch. The answer is considered correct if it's absolute or relative error doesn't exceed 10 - 4.

Examples

Input

3 2 2
1.000 0.000 0.500
0.000 1.000 0.500


Output

2.75


Input

4 1 3
0.100 0.500 0.500 0.600
0.100 0.500 0.900 0.400


Output

2.16


Input

3 2 0
0.412 0.198 0.599
0.612 0.987 0.443


Output

1.011

Solution (in CPP):

Solution:
#include <bits/stdc++.h>
using namespace std;
struct node {
  node* left;
  node* right;
  long double a;
  int priority;
  int sz;
  long double sum;
  node(long double a, int priority)
      : sz(1), a(a), priority(priority), sum(a), left(0), right(0){};
};
void upd(node*& v) {
  v->sz = 1;
  v->sum = v->a;
  if (!v->left) {
  } else {
    v->sz += v->left->sz;
    v->sum += v->left->sum;
  }
  if (!v->right) {
  } else {
    v->sz += v->right->sz;
    v->sum += v->right->sum;
  }
}
void split(node* v, node*& l, node*& r, long double a) {
  if (!v) {
    l = r = NULL;
    return;
  }
  if (v->a <= a) {
    split(v->right, v->right, r, a);
    l = v;
    upd(l);
  } else {
    split(v->left, l, v->left, a);
    r = v;
    upd(r);
  }
}
void split1(node* v, node*& l, node*& r, int sz) {
  if (!v) {
    l = r = NULL;
    return;
  }
  int sz1 = 0;
  if (!v->right) {
  } else {
    sz1 += v->right->sz;
  }
  if (sz1 + 1 <= sz) {
    split1(v->left, l, v->left, sz - (sz1 + 1));
    r = v;
    upd(r);
  } else {
    split1(v->right, v->right, r, sz);
    l = v;
    upd(l);
  }
}
node* merge(node* l, node* r) {
  if (!l) {
    return r;
  } else if (!r) {
    return l;
  }
  if (l->priority > r->priority) {
    l->right = merge(l->right, r);
    upd(l);
    return l;
  } else {
    r->left = merge(l, r->left);
    upd(r);
    return r;
  }
}
void add(node*& root, long double val) {
  node* L;
  node* R;
  split(root, L, R, val);
  node* v = new node(val, rand());
  L = merge(L, v);
  root = merge(L, R);
}
void erase(node*& root, long double val) {
  node* L;
  node* R;
  split(root, L, R, val);
  node* L1;
  node* R1;
  split1(L, L1, R1, 1);
  root = merge(L1, R);
}
signed main() {
  int n, a, b;
  cin >> n >> a >> b;
  vector<long double> p(n), u(n);
  vector<pair<long double, int> > mass;
  for (int i = 0; i < n; i++) {
    cin >> p[i];
  }
  for (int i = 0; i < n; i++) {
    cin >> u[i];
    mass.push_back({u[i], i});
  }
  if (b == 0) {
    sort(p.begin(), p.end());
    long double ans = 0;
    for (int i = n - 1; i >= n - a; i--) {
      ans += p[i];
    }
    cout << fixed << setprecision(6) << ans;
    return 0;
  } else if (a == 0) {
    sort(u.begin(), u.end());
    long double ans = 0;
    for (int i = n - 1; i >= n - b; i--) {
      ans += u[i];
    }
    cout << fixed << setprecision(6) << ans;
    return 0;
  }
  sort(mass.begin(), mass.end());
  reverse(mass.begin(), mass.end());
  long double ans = 0;
  node* tree;
  node* tree1;
  vector<long double> pref1(n + 1);
  vector<long double> pref(n + 1);
  for (int i = 0; i < n; i++) {
    pref[i + 1] += pref[i];
    pref1[i + 1] += pref1[i];
    pref[i + 1] += p[mass[i].second];
    pref1[i + 1] += u[mass[i].second];
  }
  for (int i = 0; i < n; i++) {
    if (b > i + 1) {
      continue;
    }
    tree1 = NULL;
    tree = NULL;
    vector<pair<long double, int> > mass1;
    for (int j = 0; j <= i; j++) {
      add(tree1, u[mass[j].second] - p[mass[j].second]);
      mass1.push_back(
          {(1 - p[mass[j].second]) * u[mass[j].second], mass[j].second});
    }
    for (int j = i + 1; j < n; j++) {
      add(tree, p[mass[j].second]);
    }
    sort(mass1.begin(), mass1.end());
    reverse(mass1.begin(), mass1.end());
    long double sum = 0;
    for (int j = 0; j < mass1.size(); j++) {
      pref[j + 1] = pref1[j + 1] = 0;
      pref[j + 1] += pref[j];
      pref1[j + 1] += pref1[j];
      pref[j + 1] += p[mass1[j].second];
      pref1[j + 1] += u[mass1[j].second];
    }
    if (a + b >= i + 1 && a - ((i + 1) - b) <= n - (i + 1)) {
      node* L;
      node* R;
      split1(tree1, L, R, b);
      sum += R->sum;
      sum += pref[i + 1];
      tree1 = merge(L, R);
      node* L1;
      node* R1;
      split1(tree, L1, R1, a - ((i + 1) - b));
      if (!R1) {
      } else {
        sum += R1->sum;
      }
      tree = merge(L1, R1);
      ans = max(ans, sum);
    }
    for (int j = 0; j < mass1.size(); j++) {
      if (b < j + 1) {
        continue;
      }
      sum = 0;
      add(tree, p[mass1[j].second] * (1 - u[mass1[j].second]));
      erase(tree1, u[mass1[j].second] - p[mass1[j].second]);
      int b2 = b - (j + 1);
      int len = (i + 1) - (j + 1);
      if (b2 > len) {
        continue;
      }
      int a2 = len - b2;
      if (a2 > a) {
        continue;
      }
      sum += pref[i + 1];
      sum -= pref[j + 1];
      sum += pref1[j + 1];
      node* L;
      node* R;
      node* L1;
      node* R1;
      split1(tree1, L, R, b2);
      if (!R) {
      } else {
        sum += R->sum;
      }
      tree1 = merge(L, R);
      split1(tree, L1, R1, a - a2);
      if (!R1) {
      } else {
        sum += R1->sum;
      }
      tree = merge(L1, R1);
      ans = max(ans, sum);
    }
  }
  cout << fixed << setprecision(10) << ans;
  return 0;
}