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>
#pragma comment(linker, "/STACK:32000000")
using namespace std;
inline bool read(int& val) { return scanf("%d", &val) != -1; }
inline bool read(long long& val) { return scanf("%I64d", &val) != -1; }
inline bool read(double& val) { return scanf("%lf", &val) != -1; }
inline bool read(char* val) { return scanf("%s", val) != -1; }
template <class T1, class T2>
inline bool read(T1& a, T2& b) {
  return read(a) && read(b);
}
template <class T1, class T2, class T3>
inline bool read(T1& a, T2& b, T3& c) {
  return read(a) && read(b) && read(c);
}
template <class T1, class T2, class T3, class T4>
inline bool read(T1& a, T2& b, T3& c, T4& d) {
  return read(a) && read(b) && read(c) && read(d);
}
template <class T1, class T2, class T3, class T4, class T5>
inline bool read(T1& a, T2& b, T3& c, T4& d, T5& e) {
  return read(a) && read(b) && read(c) && read(d) && read(e);
}
const int N = 21111;
const int inf = 0x3FFFFFFF;
const int nil = -1;
const double eps = 1e-11;
struct graphics {
  template <class T>
  struct queue {
    T val[N * 100];
    int l, r;
    queue() : l(0), r(0) {}
    void init() { l = r = 0; }
    void push(T x) { val[r++] = x; }
    void pop() {
      l++;
      if (l == r) l = r = 0;
    }
    bool empty() { return l == r; }
    T& front() { return val[l]; }
    T& back() { return val[r - 1]; }
  };
  struct state {
    double dis;
    int e, u;
    state() {}
    state(double dis, int p, int u) : dis(dis), e(p), u(u) {}
    friend bool operator<(state a, state b) { return a.dis > b.dis; }
  };
  int n;
  int head[N];
  int id;
  int to[N];
  int next[N];
  double cost[N];
  void init(int n) {
    id = 0;
    this->n = n;
    for (int i = 0, _ = (n); i < _; ++i) head[i] = nil;
  }
  int add1(int u, int v, double val) {
    to[id] = v;
    cost[id] = val;
    next[id] = head[u];
    head[u] = id;
    return id++;
  }
  int flow[N], cap[N];
  void addf(int u, int v, int c, double cost = 0) {
    int e = add1(u, v, cost);
    flow[e] = 0;
    cap[e] = c;
    e = add1(v, u, -cost);
    flow[e] = 0;
    cap[e] = 0;
  }
  queue<state> que;
  bool spfa(int s, double dis[], int edge[]) {
    static int cnt[N];
    for (int i = 0, _ = (n); i < _; ++i) cnt[i] = 0;
    for (int i = 0, _ = (n); i < _; ++i) {
      dis[i] = inf;
      edge[i] = nil;
    }
    que.push(state(0, nil, s));
    while (!que.empty()) {
      state cur = que.front();
      que.pop();
      int u = cur.u;
      if (dis[u] > cur.dis + eps) {
        dis[u] = cur.dis;
        edge[u] = cur.e;
        if (++cnt[u] > n) return false;
        for (int e = head[u], v; e != nil && (v = to[e], true); e = next[e])
          if (flow[e] < cap[e]) que.push(state(cur.dis + cost[e], e, v));
      }
    }
    return true;
  }
  double mincost_maxflow(int s, int t) {
    static double dis[N];
    static int edge[N];
    for (int maxf = 0, f = inf;; maxf += f, f = inf) {
      if (!spfa(s, dis, edge)) return -inf;
      if (edge[t] == nil) break;
      for (int u = t; edge[u] != nil; u = to[edge[u] ^ 1])
        f = min(f, cap[edge[u]] - flow[edge[u]]);
      for (int u = t; edge[u] != nil; u = to[edge[u] ^ 1]) {
        flow[edge[u]] += f;
        flow[edge[u] ^ 1] -= f;
      }
    }
    double minc = 0;
    for (int e = 0, _ = (id); e < _; ++e)
      if (cap[e] > 0) minc += flow[e] * cost[e];
    return minc;
  }
} g;
double P[N], U[N];
int main() {
  int n, a, b;
  read(n, a, b);
  for (int i = 0, _ = (n); i < _; ++i) read(P[i]);
  for (int i = 0, _ = (n); i < _; ++i) read(U[i]);
  int s = 0, sa = s + 1, sb = sa + 1, ab = sb + 1, t1 = ab + n, t2 = t1 + 1,
      t = t2 + 1;
  g.init(t + 1);
  g.addf(s, sa, a, 0);
  g.addf(s, sb, b, 0);
  g.addf(t1, t, n, 0);
  g.addf(t2, t, n, 0);
  for (int i = 0, _ = (n); i < _; ++i) {
    g.addf(sa, ab + i, 1, -P[i]);
    g.addf(sb, ab + i, 1, -U[i]);
    g.addf(ab + i, t1, 1, 0);
    g.addf(ab + i, t2, 1, P[i] * U[i]);
  }
  printf("%.8f\n", -g.mincost_maxflow(s, t));
  return 0;
}