Startup Funding

An e-commerce startup pitches to the investors to get funding. They have been functional for n weeks now and also have a website!

For each week they know the number of unique visitors during this week v i and the revenue c i. To evaluate the potential of the startup at some range of weeks from l to r inclusive investors use the minimum among the maximum number of visitors multiplied by 100 and the minimum revenue during this period, that is:

The truth is that investors have no idea how to efficiently evaluate the startup, so they are going to pick some k random distinct weeks l i and give them to managers of the startup. For each l i they should pick some r i ≥ l i and report maximum number of visitors and minimum revenue during this period.

Then, investors will calculate the potential of the startup for each of these ranges and take minimum value of p(l i, r i) as the total evaluation grade of the startup. Assuming that managers of the startup always report the optimal values of r i for some particular l i, i.e., the value such that the resulting grade of the startup is maximized, what is the expected resulting grade of the startup?

Input

The first line of the input contains two integers n and k (1 ≤ k ≤ n ≤ 1 000 000).

The second line contains n integers v i (1 ≤ v i ≤ 107) — the number of unique visitors during each week.

The third line contains n integers c i (1 ≤ c i ≤ 107) —the revenue for each week.

Output

Print a single real value — the expected grade of the startup. Your answer will be considered correct if its absolute or relative error does not exceed 10 - 6.

Namely: let’s assume that your answer is a, and the answer of the jury is b. The checker program will consider your answer correct, if  .

Examples

input

3 2
3 2 1
300 200 300

output

133.3333333

Note

Consider the first sample.

If the investors ask for l i = 1 onwards, startup will choose r i = 1, such that max number of visitors is 3 and minimum revenue is 300. Thus, potential in this case is min(3·100, 300) = 300.

If the investors ask for l i = 2 onwards, startup will choose r i = 3, such that max number of visitors is 2 and minimum revenue is 200. Thus, potential in this case is min(2·100, 200) = 200.

If the investors ask for l i = 3 onwards, startup will choose r i = 3, such that max number of visitors is 1 and minimum revenue is 300. Thus, potential in this case is min(1·100, 300) = 100.

We have to choose a set of size 2 equi-probably and take minimum of each. The possible sets here are : {200, 300},{100, 300},{100, 200}, effectively the set of possible values as perceived by investors equi-probably: {200, 100, 100}. Thus, the expected value is (100 + 200 + 100) / 3 = 133.(3).

Solution:

#include <bits/stdc++.h>

using namespace std;

const int inf = (int) 1.01e9;

const int N = 1234567;

int va[N], vl[N], vr[N];
int ca[N], cl[N], cr[N];
int n;

inline void modify_max(int q, int v) {
va[q] = v;
int x = q;
while (x <= n) {
    if (v > vl[x]) {
vl[x] = v;
}
x = (x | (x - 1)) + 1;
}
x = q;
while (x > 0) {
if (v > vr[x]) {
vr[x] = v;
}
x &= x - 1;
}
}

inline void modify_min(int q, int v) {
ca[q] = v;
int x = q;
while (x <= n) {
    if (v < cl[x]) {
      cl[x] = v;
    }
    x = (x | (x - 1)) + 1;
  }
  x = q;
  while (x > 0) {
if (v < cr[x]) {
      cr[x] = v;
    }
    x &= x - 1;
  }
}

inline int find_max(int ll, int rr) {
  int v = 0;
  int x = ll;
  while ((x | (x - 1)) + 1 <= rr) {
    if (vr[x] > v) {
v = vr[x];
}
x = (x | (x - 1)) + 1;
}
if (va[x] > v) {
v = va[x];
}
x = rr;
while ((x & (x - 1)) >= ll) {
if (vl[x] > v) {
v = vl[x];
}
x &= x - 1;
}
return v;
}

inline int find_min(int ll, int rr) {
int v = inf;
int x = ll;
while ((x | (x - 1)) + 1 <= rr) {
    if (cr[x] < v) {
      v = cr[x];
    }
    x = (x | (x - 1)) + 1;
  }
  if (ca[x] < v) {
    v = ca[x];
  }
  x = rr;
  while ((x & (x - 1)) >= ll) {
if (cl[x] < v) {
      v = cl[x];
    }
    x &= x - 1;
  }
  return v;
}

int v[N], c[N];

inline void init(int nn) {
  n = nn;
  for (int i = 1; i <= n; i++) {
    va[i] = vl[i] = vr[i] = 0;
  }
  for (int i = 1; i <= n; i++) {
    modify_max(i, v[i]);
  }
  for (int i = 1; i <= n; i++) {
    ca[i] = cl[i] = cr[i] = inf;
  }
  for (int i = 1; i <= n; i++) {
    modify_min(i, c[i]);
  }
}

inline int test(int from, int to) {
  if (to < from || to > n) {
return 0;
}
return min(find_max(from, to) * 100, find_min(from, to));
}

int res[N];

int main() {
int n, k;
scanf("%d %d", &n, &k);
for (int i = 1; i <= n; i++) {
    scanf("%d", v + i);
  }
  for (int i = 1; i <= n; i++) {
    scanf("%d", c + i);
  }
  init(n);
  for (int i = 1; i <= n; i++) {
    int low = i - 1, high = n + 1;
    while (low + 1 < high) {
      int mid = (low + high) >> 1;
int x = find_max(i, mid) * 100;
int y = find_min(i, mid);
if (x < y) {
        low = mid;
      } else {
        high = mid;
      }
    }
    res[i - 1] = max(test(i, low), test(i, high));
  }
  sort(res, res + n);
  double ans = 0.0;
  double prob = 1.0;
  for (int i = 0; i <= n - k; i++) {
    if (prob < 1e-100) {
      break;
    }
    double q = k * 1.0 / (n - i);
    ans += prob * q * res[i];
    prob *= (1.0 - q);
  }
  printf("%.17f\n", ans);
  return 0;
}