#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>

#define MAX 100005

using namespace std;

typedef long long int lli;

int pointer;
vector<lli> M;
vector<lli> B;

bool bad(int l1, int l2, int l3);
void add(lli m, lli b);
lli query(lli x);

int main()
{
    int n, i, a[MAX], b[MAX];
    lli cost;
    scanf("%d",&n);
    for (i=0; i<n; i++)
        scanf("%d",&a[i]);

    for (i=0; i<n; i++)
        scanf("%d",&b[i]);

    add(b[0], 0);
    pointer=0;
    for(i=0;i<n;i++)
    {
        cost = query(a[i]);
        if (i<n)
            add(a[i], cost);
    }
    printf("%lld\n",cost);
    return 0;
}

bool bad(int l1, int l2, int l3)
{
    return (B[l3]-B[l1])*(M[l1]-M[l2])<(B[l2]-B[l1])*(M[l1]-M[l3]);
}

void add(lli m, lli b)
{
    M.push_back(m);
    B.push_back(b);
    while (M.size()>=3&&bad(M.size()-3,M.size()-2,M.size()-1))
    {
            M.erase(M.end()-2);
            B.erase(B.end()-2);
    }
}

lli query(lli x)
{
    if (pointer >=M.size()) pointer=M.size()-1;
    while (pointer < M.size()-1 && M[pointer+1]*x + B[pointer+1] > M[pointer]*x + B[pointer]) pointer++;
    return M[pointer]*x + B[pointer];
}


#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>

#define MAX 100005

using namespace std;

typedef long long int lli;

int pointer;
vector<lli> M;
vector<lli> B;

bool bad(int l1, int l2, int l3);
void add(lli m, lli b);
lli query(lli x);

int main()
{
    int n, i, a[MAX], b[MAX], j;
    lli cost = 0;
    scanf("%d",&n);
    for (i=0;i<n;i++) scanf("%d",&a[i]);
    for (i=0;i<n;i++) scanf("%d",&b[i]);

    pointer=0;
    add(b[0],b[0]);
    for (i=1;i<n;i++) {
        printf("M ");
        for(j=0;j<M.size();j++) printf("%lld ",M[j]);
        printf("\nB ");
        for(j=0;j<B.size();j++) printf("%lld ",B[j]);
        printf("\n");

        cost = query(a[i]);
        add(b[i], cost);

        printf("cost %lld pointer %lld\n\n",cost, pointer);
    }
    printf("%lld\n",cost-b[0]);
    return 0;
}

bool bad(int l1,int l2,int l3)
{
    return (B[l3]-B[l1])*(M[l1]-M[l2]) < (B[l2]-B[l1])*(M[l1]-M[l3]);
}

void add(lli m, lli b)
{
    M.push_back(m);
    B.push_back(b);
    while((M.size()>=3) && bad(M.size()-3, M.size()-2, M.size()-1))
    {
        M.erase(M.end()-2);
        B.erase(B.end()-2);
    }
}

lli query(lli x)
{
    if (pointer >= M.size()) pointer = M.size() - 1;
    while(pointer < M.size()-1 && M[pointer+1]*x + B[pointer+1] < M[pointer]*x + B[pointer]) pointer++;
    return M[pointer]*x + B[pointer];
}


#include <iostream>
#include <vector>
#include <algorithm>
#include <cstdio>

#define MAX 100005

using namespace std;

typedef long long int lli;

int pointer;
vector<lli> M, B;
lli a[MAX], b[MAX];

bool bad(int l1, int l2, int l3);
void add(lli m, lli b);
lli query(lli x);

int main()
{
	int n,i;
	lli cost;
	scanf("%d",&n);
	for(i=0;i<n;i++) scanf("%lld",&a[i]);
	for(i=0;i<n;i++) scanf("%lld",&b[i]);

	cost = 0;
	add(b[0], cost);
	pointer=0;
	// printf("0: %lld\n",cost);
	for(i=1;i<n;i++) {
		cost = query(a[i]);
		add(b[i], cost);
		// printf("%d: %lld\n",i, cost);
	}
	printf("%lld\n",cost);
	return 0;
}

bool bad(int l1,int l2,int l3)
{
	return (B[l3]-B[l1])*(M[l1]-M[l2]) <= (B[l2]-B[l1])*(M[l1]-M[l3]);
}

void add(lli m, lli b)
{
	M.push_back(m);
	B.push_back(b);
	while((M.size()>=3) && bad(M.size()-3, M.size()-2, M.size()-1)) {
		M.erase(M.end()-2);
		B.erase(B.end()-2);
	}
}

lli query(lli x)
{
	if (pointer >= M.size()) pointer = M.size() - 1;
	while(pointer < M.size()-1 && M[pointer+1]*x + B[pointer+1] <= M[pointer]*x + B[pointer]) pointer++;
	return M[pointer]*x + B[pointer];
}


#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>

#define MAX 100005

using namespace std;

typedef long long int lli;

lli pointer;
vector<lli> M;
vector<lli> B;

bool bad(lli l1, lli l2, lli l3);
void add(lli m, lli b);
lli query(lli x);

int main()
{
	lli n, i, a[MAX], b[MAX], j;
	lli cost = 0;
	scanf("%lld",&n);
	for (i=0;i<n;i++) scanf("%lld",&a[i]);
	for (i=0;i<n;i++) scanf("%lld",&b[i]);

	pointer=0;
	add(b[0],0);
	for (i=0;i<n;i++) {
		// printf("M ");
		// for(j=0;j<M.size();j++) printf("%lld ",M[j]);
		// printf("\nB ");
		// for(j=0;j<B.size();j++) printf("%lld ",B[j]);
		// printf("\n");

		cost = query(a[i]);
		add(b[i], cost);

		// printf("cost %lld pointer %lld\n\n",cost, pointer);
	}
	printf("%lld\n",cost);
	return 0;
}

bool bad(lli l1,lli l2,lli l3)
{
	return (B[l3]-B[l1])*(M[l1]-M[l2]) < (B[l2]-B[l1])*(M[l1]-M[l3]);
}

void add(lli m, lli b)
{
	M.push_back(m);
	B.push_back(b);
	while((M.size()>=3) && bad(M.size()-3, M.size()-2, M.size()-1))
	{
		M.erase(M.end()-2);
		B.erase(B.end()-2);
	}
}

lli query(lli x)
{
	if (pointer >= M.size()) pointer = M.size() - 1;
	while(pointer < M.size()-1 && M[pointer+1]*x + B[pointer+1] < M[pointer]*x + B[pointer]) pointer++;
	return M[pointer]*x + B[pointer];
}


#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>

#define MAX 100005

using namespace std;

typedef long long int lli;

int pointer;
vector<lli> M;
vector<lli> B;

bool bad(int l1, int l2, int l3);
void add(lli m, lli b);
lli query(lli x);

int main()
{
	int n, i, a[MAX], b[MAX], j;
	lli cost = 0;
	scanf("%d",&n);
	for (i=0;i<n;i++) scanf("%d",&a[i]);
	for (i=0;i<n;i++) scanf("%d",&b[i]);

	pointer=0;
	add(b[0],0);
	for (i=0;i<n;i++) {
		// printf("M ");
		// for(j=0;j<M.size();j++) printf("%lld ",M[j]);
		// printf("\nB ");
		// for(j=0;j<B.size();j++) printf("%lld ",B[j]);
		// printf("\n");

		cost = query(a[i]);
		add(b[i], cost);

		// printf("cost %lld pointer %lld\n\n",cost, pointer);
	}
	printf("%lld\n",cost);
	return 0;
}

bool bad(int l1,int l2,int l3)
{
	return (B[l3]-B[l1])*(M[l1]-M[l2]) < (B[l2]-B[l1])*(M[l1]-M[l3]);
}

void add(lli m, lli b)
{
	M.push_back(m);
	B.push_back(b);
	while((M.size()>=3) && bad(M.size()-3, M.size()-2, M.size()-1))
	{
		M.erase(M.end()-2);
		B.erase(B.end()-2);
	}
}

lli query(lli x)
{
	if (pointer >= M.size()) pointer = M.size() - 1;
	while(pointer < M.size()-1 && M[pointer+1]*x + B[pointer+1] < M[pointer]*x + B[pointer]) pointer++;
	return M[pointer]*x + B[pointer];
}


#include <iostream>
#include <vector>
#include <algorithm>
#include <cstdio>

#define MAX 100005

using namespace std;

typedef long long int lli;

int pointer;
vector<lli> M, B;
lli a[MAX], b[MAX];

bool bad(int l1, int l2, int l3);
void add(lli m, lli b);
lli query(lli x);

int main()
{
    int n,i;
    lli cost;
    scanf("%d",&n);
    for(i=0;i<n;i++) scanf("%lld",&a[i]);
    for(i=0;i<n;i++) scanf("%lld",&b[i]);

    cost = 0;
    add(b[0], cost);
    pointer=0;
    // printf("0: %lld\n",cost);
    for(i=1;i<n;i++) {
        cost = query(a[i]);
        add(b[i], cost);
        // printf("%d: %lld\n",i, cost);
    }
    printf("%lld\n",cost);
    return 0;
}

bool bad(int l1,int l2,int l3)
{
    return (B[l3]-B[l1])*(M[l1]-M[l2]) < (B[l2]-B[l1])*(M[l1]-M[l3]);
}

void add(lli m, lli b)
{
    M.push_back(m);
    B.push_back(b);
    while((M.size()>=3) && bad(M.size()-3, M.size()-2, M.size()-1)) {
        M.erase(M.end()-2);
        B.erase(B.end()-2);
    }
}

lli query(lli x)
{
    if (pointer >= M.size()) pointer = M.size() - 1;
    while(pointer < M.size()-1 && M[pointer+1]*x + B[pointer+1] <= M[pointer]*x + B[pointer]) pointer++;
    return M[pointer]*x + B[pointer];
}


#include<cstdio>
#include<cstring>
#include<climits>
#include<string>
#include<algorithm>
#include<cmath>
#include<iostream>
#include<queue>
#include<vector>
#include<stack>
#include<map>
#include<set>
#include<stdlib.h>
#include<ctime>
using namespace std;
typedef long long ll;

const int MAXN = 100007;
int a[MAXN], b[MAXN];
int que[MAXN], f, r;
ll dp[MAXN];

void addans(int p) {
    while(f+1 < r) {
        int p1 = que[r-2];
        int p2 = que[r-1];
        if( (dp[p]-dp[p2]) * (-b[p2]+b[p1]) < (dp[p2]-dp[p1]) * (-b[p]+b[p2])) r--;
        else break;
    }
    que[r++] = p;
}

ll getans(int p) {
    while(f+1 < r) {
        int p1 = que[f];
        int p2 = que[f+1];
        if( (dp[p2]-dp[p1]) < 1LL*a[p]*(-b[p2]+b[p1])) f++;
        else break;
    }
    return dp[que[f]] + 1LL*b[que[f]]*a[p];
}

int main() {
    //freopen("data.in", "r", stdin);freopen("data1.out", "w", stdout);
    int n;
    while(~scanf("%d", &n)) {
        int i, j;
        for(i = 1; i <= n; i++) scanf("%d", a+i);
        for(i = 1; i <= n; i++) scanf("%d", b+i);
        dp[1] = f = r = 0;
        addans(1);
        for(i = 2; i <= n; i++) {
            dp[i] = getans(i);
            addans(i);
        }
        printf("%d\n", dp[n]);
    }
    return 0;
}


#include<cstdio>
#include<cstring>
#include<climits>
#include<string>
#include<algorithm>
#include<cmath>
#include<iostream>
#include<queue>
#include<vector>
#include<stack>
#include<map>
#include<set>
#include<stdlib.h>
#include<ctime>
using namespace std;
typedef long long ll;

const int MAXN = 100007;
int que[MAXN], f, r, N;
ll a[MAXN], b[MAXN];
ll dp[MAXN];
ll MN;

void addans(int p) {
    while(f+1 < r) {
        int p1 = que[r-2];
        int p2 = que[r-1];
        if( (dp[p]-dp[p2]) * (-b[p2]+b[p1]) < (dp[p2]-dp[p1]) * (-b[p]+b[p2])) r--;
        else break;
    }
    que[r++] = p;
}

ll getans(int p) {
    while(f+1 < r) {
        int p1 = que[f];
        int p2 = que[f+1];
        if( (dp[p2]-dp[p1]) < a[p]*(-b[p2]+b[p1])) f++;
        else break;
    }
    return dp[que[f]] + b[que[f]]*a[p];
}

int main() {
    //freopen("data.in", "r", stdin);freopen("data1.out", "w", stdout);
    int n;
    while(~scanf("%d", &n)) {
        int i, j;
        for(i = 1; i <= n; i++) scanf("%I64d", a+i);
        for(i = 1; i <= n; i++) scanf("%I64d", b+i);
        dp[1] = f = r = 0;
        MN = b[1]*a[n]; N = n;
        addans(1);
        for(i = 2; i <= n; i++) {
            dp[i] = getans(i);
            addans(i);
        }
        printf("%I64d\n", dp[n]);
    }
    return 0;
}


#include<cstdio>
#include<cstring>
#include<climits>
#include<string>
#include<algorithm>
#include<cmath>
#include<iostream>
#include<queue>
#include<vector>
#include<stack>
#include<map>
#include<set>
#include<stdlib.h>
#include<ctime>
using namespace std;
typedef long long ll;

const int MAXN = 100007;
int a[MAXN], b[MAXN];
int que[MAXN], f, r;
ll dp[MAXN];

void addans(int p) {
    while(f+1 < r) {
        int p1 = que[r-2];
        int p2 = que[r-1];
        if( (dp[p]-dp[p2]) * (b[p2]-b[p1]) > (dp[p2]-dp[p1]) * (b[p]-b[p2])) r--;
        else break;
    }
    que[r++] = p;
}

ll getans(int p) {
    while(f+1 < r) {
        int p1 = que[f];
        int p2 = que[f+1];
        if( -(dp[p2]-dp[p1]) > a[p]*(b[p2] - b[p1])) f++;
        else break;
    }
    return dp[que[f]] + b[que[f]]*a[p];
}

int main() {
    //freopen("data.in", "r", stdin);freopen("data1.out", "w", stdout);
    int n;
    while(~scanf("%d", &n)) {
        int i, j;
        for(i = 1; i <= n; i++) scanf("%d", a+i);
        for(i = 1; i <= n; i++) scanf("%d", b+i);
        dp[1] = f = r = 0;
        addans(1);
        for(i = 2; i <= n; i++) {
            dp[i] = getans(i);
            addans(i);
        }
        printf("%d\n", dp[n]);
    }
    return 0;
}


#include<cstdio>
#include<cstring>
#include<climits>
#include<string>
#include<algorithm>
#include<cmath>
#include<iostream>
#include<queue>
#include<vector>
#include<stack>
#include<map>
#include<set>
#include<stdlib.h>
#include<ctime>
using namespace std;
typedef long long ll;

const int MAXN = 100007;
int que[MAXN], f, r, N;
ll a[MAXN], b[MAXN];
ll dp[MAXN];
ll MN;

void addans(int p) {
    if(dp[p] > MN) return;
    while(f+1 < r) {
        int p1 = que[r-2];
        int p2 = que[r-1];
        if( (dp[p]-dp[p2]) * (-b[p2]+b[p1]) < (dp[p2]-dp[p1]) * (-b[p]+b[p2])) r--;
        else break;
    }
    que[r++] = p;
}

ll getans(int p) {
    while(f+1 < r) {
        int p1 = que[f];
        int p2 = que[f+1];
        if( (dp[p2]-dp[p1]) < a[p]*(-b[p2]+b[p1])) f++;
        else break;
    }
    //printf("dp[%d]= \n", p);
    //printf("%d: %I64d + %I64d*%I64d = %I64d\n", que[f], dp[que[f]], b[que[f]], a[p], dp[que[f]] + b[que[f]]*a[p]);
    return dp[que[f]] + b[que[f]]*a[p];
}

int main() {
    freopen("data.in", "r", stdin);freopen("data1.out", "w", stdout);
    int n;
    while(~scanf("%d", &n)) {
        int i, j;
        for(i = 1; i <= n; i++) scanf("%I64d", a+i);
        for(i = 1; i <= n; i++) scanf("%I64d", b+i);
        //printf("b[1]=%I64d\n", b[1]);
        dp[1] = f = r = 0;
        MN = b[1]*a[n]; N = n;
        addans(1);
        for(i = 2; i <= n; i++) {
            dp[i] = getans(i);
            //printf("dp[%d]=%I64d\n", i, dp[i]);
            addans(i);
        }
        printf("%I64d\n", dp[n]);
    }
    return 0;
}


#include<cstdio>
#include<cstring>
#include<climits>
#include<string>
#include<algorithm>
#include<cmath>
#include<iostream>
#include<queue>
#include<vector>
#include<stack>
#include<map>
#include<set>
#include<stdlib.h>
#include<ctime>
using namespace std;
typedef long long ll;

const int MAXN = 100007;
int que[MAXN], f, r, N;
int a[MAXN], b[MAXN];
ll dp[MAXN];
ll MN;

void addans(int p) {
    if(dp[p] > MN - b[p]*a[N]) return;
    while(f+1 < r) {
        int p1 = que[r-2];
        int p2 = que[r-1];
        if( (dp[p]-dp[p2]) * (-b[p2]+b[p1]) < (dp[p2]-dp[p1]) * (-b[p]+b[p2])) r--;
        else break;
    }
    que[r++] = p;
}

ll getans(int p) {
    while(f+1 < r) {
        int p1 = que[f];
        int p2 = que[f+1];
        if( (dp[p2]-dp[p1]) < a[p]*(-b[p2]+b[p1])) f++;
        else break;
    }
    return dp[que[f]] + b[que[f]]*a[p];
}

int main() {
    //freopen("data.in", "r", stdin);freopen("data1.out", "w", stdout);
    int n;
    while(~scanf("%d", &n)) {
        int i, j;
        for(i = 1; i <= n; i++) scanf("%I64d", a+i);
        for(i = 1; i <= n; i++) scanf("%I64d", b+i);
        dp[1] = f = r = 0;
        MN = b[1]*a[n]; N = n;
        addans(1);
        for(i = 2; i <= n; i++) {
            dp[i] = getans(i);
            addans(i);
        }
        printf("%d\n", dp[n]);
    }
    return 0;
}


#include<cstdio>
#include<cstring>
#include<climits>
#include<string>
#include<algorithm>
#include<cmath>
#include<iostream>
#include<queue>
#include<vector>
#include<stack>
#include<map>
#include<set>
#include<stdlib.h>
#include<ctime>
using namespace std;
typedef long long ll;

const int MAXN = 100007;
int a[MAXN], b[MAXN];
int que[MAXN], f, r;
ll dp[MAXN];

void addans(int p) {
    while(f+1 < r) {
        int p1 = que[r-2];
        int p2 = que[r-1];
        if( (dp[p]-dp[p2]) * (-b[p2]+b[p1]) < (dp[p2]-dp[p1]) * (-b[p]+b[p2])) r--;
        else break;
    }
    que[r++] = p;
}

ll getans(int p) {
    while(f+1 < r) {
        int p1 = que[f];
        int p2 = que[f+1];
        if( (dp[p2]-dp[p1]) < a[p]*(-b[p2]+b[p1])) f++;
        else break;
    }
    return dp[que[f]] + b[que[f]]*a[p];
}

int main() {
    //freopen("data.in", "r", stdin);freopen("data1.out", "w", stdout);
    int n;
    while(~scanf("%d", &n)) {
        int i, j;
        for(i = 1; i <= n; i++) scanf("%d", a+i);
        for(i = 1; i <= n; i++) scanf("%d", b+i);
        dp[1] = f = r = 0;
        addans(1);
        for(i = 2; i <= n; i++) {
            dp[i] = getans(i);
            addans(i);
        }
        printf("%d\n", dp[n]);
    }
    return 0;
}


#include<cstdio>
#include<cstring>
#include<climits>
#include<string>
#include<algorithm>
#include<cmath>
#include<iostream>
#include<queue>
#include<vector>
#include<stack>
#include<map>
#include<set>
#include<stdlib.h>
#include<ctime>
using namespace std;
typedef long long ll;

const int MAXN = 100007;
int que[MAXN], f, r, N;
ll a[MAXN], b[MAXN];
ll dp[MAXN];
ll MN;

void addans(int p) {
    if(dp[p] > MN) return;
    while(f+1 < r) {
        int p1 = que[r-2];
        int p2 = que[r-1];
        if( (dp[p]-dp[p2]) * (-b[p2]+b[p1]) < (dp[p2]-dp[p1]) * (-b[p]+b[p2])) r--;
        else break;
    }
    que[r++] = p;
}

ll getans(int p) {
    while(f+1 < r) {
        int p1 = que[f];
        int p2 = que[f+1];
        if( (dp[p2]-dp[p1]) < a[p]*(-b[p2]+b[p1])) f++;
        else break;
    }
    //printf("dp[%d]= \n", p);
    //printf("%d: %I64d + %I64d*%I64d = %I64d\n", que[f], dp[que[f]], b[que[f]], a[p], dp[que[f]] + b[que[f]]*a[p]);
    return dp[que[f]] + b[que[f]]*a[p];
}

int main() {
    //freopen("data.in", "r", stdin);freopen("data1.out", "w", stdout);
    int n;
    while(~scanf("%d", &n)) {
        int i, j;
        for(i = 1; i <= n; i++) scanf("%I64d", a+i);
        for(i = 1; i <= n; i++) scanf("%I64d", b+i);
        //printf("b[1]=%I64d\n", b[1]);
        dp[1] = f = r = 0;
        MN = b[1]*a[n]; N = n;
        addans(1);
        for(i = 2; i <= n; i++) {
            dp[i] = getans(i);
            //printf("dp[%d]=%I64d\n", i, dp[i]);
            addans(i);
        }
        printf("%I64d\n", dp[n]);
    }
    return 0;
}


#include<cstdio>
#include<cstring>
#include<climits>
#include<string>
#include<algorithm>
#include<cmath>
#include<iostream>
#include<queue>
#include<vector>
#include<stack>
#include<map>
#include<set>
#include<stdlib.h>
#include<ctime>
using namespace std;
typedef long long ll;

const int MAXN = 100007;
int que[MAXN], f, r, N;
int a[MAXN], b[MAXN];
ll dp[MAXN];
ll MN;

void addans(int p) {
    if(dp[p] > MN) return;
    while(f+1 < r) {
        int p1 = que[r-2];
        int p2 = que[r-1];
        if( (dp[p]-dp[p2]) * (-b[p2]+b[p1]) < (dp[p2]-dp[p1]) * (-b[p]+b[p2])) r--;
        else break;
    }
    que[r++] = p;
}

ll getans(int p) {
    while(f+1 < r) {
        int p1 = que[f];
        int p2 = que[f+1];
        if( (dp[p2]-dp[p1]) < a[p]*(-b[p2]+b[p1])) f++;
        else break;
    }
    return dp[que[f]] + b[que[f]]*a[p];
}

int main() {
    //freopen("data.in", "r", stdin);freopen("data1.out", "w", stdout);
    int n;
    while(~scanf("%d", &n)) {
        int i, j;
        for(i = 1; i <= n; i++) scanf("%I64d", a+i);
        for(i = 1; i <= n; i++) scanf("%I64d", b+i);
        dp[1] = f = r = 0;
        MN = b[1]*a[n]; N = n;
        addans(1);
        for(i = 2; i <= n; i++) {
            dp[i] = getans(i);
            addans(i);
        }
        printf("%d\n", dp[n]);
    }
    return 0;
}


#include<cstdio>
#include<cstring>
#include<climits>
#include<string>
#include<algorithm>
#include<cmath>
#include<iostream>
#include<queue>
#include<vector>
#include<stack>
#include<map>
#include<set>
#include<stdlib.h>
#include<ctime>
using namespace std;
typedef long long ll;

const int MAXN = 100007;
int que[MAXN], f, r, N;
ll a[MAXN], b[MAXN];
ll dp[MAXN];
ll MN;

void addans(int p) {
    while(f+1 < r) {
        int p1 = que[r-2];
        int p2 = que[r-1];
        if( (dp[p]-dp[p2]) * (-b[p2]+b[p1]) < (dp[p2]-dp[p1]) * (-b[p]+b[p2])) r--;
        else break;
    }
    que[r++] = p;
}

ll getans(int p) {
    while(f+1 < r) {
        int p1 = que[f];
        int p2 = que[f+1];
        if( (dp[p2]-dp[p1]) < a[p]*(-b[p2]+b[p1])) f++;
        else break;
    }
    //printf("dp[%d]= \n", p);
    //printf("%d: %I64d + %I64d*%I64d = %I64d\n", que[f], dp[que[f]], b[que[f]], a[p], dp[que[f]] + b[que[f]]*a[p]);
    return dp[que[f]] + b[que[f]]*a[p];
}

int main() {
    //freopen("data.in", "r", stdin);freopen("data1.out", "w", stdout);
    int n;
    while(~scanf("%d", &n)) {
        int i, j;
        for(i = 1; i <= n; i++) scanf("%I64d", a+i);
        for(i = 1; i <= n; i++) scanf("%I64d", b+i);
        //printf("b[1]=%I64d\n", b[1]);
        dp[1] = f = r = 0;
        MN = b[1]*a[n]; N = n;
        addans(1);
        for(i = 2; i <= n; i++) {
            dp[i] = getans(i);
            //printf("dp[%d]=%I64d\n", i, dp[i]);
            addans(i);
        }
        printf("%I64d\n", dp[n]);
    }
    return 0;
}


#include<cstdio>
#include<cstring>
#include<climits>
#include<string>
#include<algorithm>
#include<cmath>
#include<iostream>
#include<queue>
#include<vector>
#include<stack>
#include<map>
#include<set>
#include<stdlib.h>
#include<ctime>
using namespace std;
typedef long long ll;

const int MAXN = 100007;
int que[MAXN], f, r, N;
ll a[MAXN], b[MAXN];
ll dp[MAXN];
ll MN;

void addans(int p) {
    while(f+1 < r) {
        int p1 = que[r-2];
        int p2 = que[r-1];
        if( 1.0 * (dp[p]-dp[p2]) * (-b[p2]+b[p1]) <= 1.0 * (dp[p2]-dp[p1]) * (-b[p]+b[p2])) r--;
        else break;
    }
    que[r++] = p;
}

ll getans(int p) {
    while(f+1 < r) {
        int p1 = que[f];
        int p2 = que[f+1];
        if( (dp[p2]-dp[p1]) <= a[p]*(-b[p2]+b[p1])) f++;
        else break;
    }
    return dp[que[f]] + b[que[f]]*a[p];
}

int main() {
    //freopen("data.in", "r", stdin);freopen("data1.out", "w", stdout);
    int n;
    while(~scanf("%d", &n)) {
        int i, j;
        for(i = 1; i <= n; i++) scanf("%I64d", a+i);
        for(i = 1; i <= n; i++) scanf("%I64d", b+i);
        dp[1] = f = r = 0;
        addans(1);
        for(i = 2; i <= n; i++) {
            dp[i] = getans(i);
            addans(i);
        }
        printf("%I64d\n", dp[n]);
    }
    return 0;
}


#include<cstdio>
#include<cstring>
#include<climits>
#include<string>
#include<algorithm>
#include<cmath>
#include<iostream>
#include<queue>
#include<vector>
#include<stack>
#include<map>
#include<set>
#include<stdlib.h>
#include<ctime>
using namespace std;
typedef long long ll;

const int MAXN = 100007;
int que[MAXN], f, r;
ll a[MAXN], b[MAXN];
ll dp[MAXN];

void addans(int p) {
    while(f+1 < r) {
        int p1 = que[r-2];
        int p2 = que[r-1];
        if( (dp[p]-dp[p2]) * (-b[p2]+b[p1]) < (dp[p2]-dp[p1]) * (-b[p]+b[p2])) r--;
        else break;
    }
    que[r++] = p;
}

ll getans(int p) {
    while(f+1 < r) {
        int p1 = que[f];
        int p2 = que[f+1];
        if( (dp[p2]-dp[p1]) < a[p]*(-b[p2]+b[p1])) f++;
        else break;
    }
    return dp[que[f]] + b[que[f]]*a[p];
}

int main() {
    //freopen("data.in", "r", stdin);freopen("data1.out", "w", stdout);
    int n;
    while(~scanf("%d", &n)) {
        int i, j;
        for(i = 1; i <= n; i++) scanf("%I64d", a+i);
        for(i = 1; i <= n; i++) scanf("%I64d", b+i);
        dp[1] = f = r = 0;
        addans(1);
        for(i = 2; i <= n; i++) {
            dp[i] = getans(i);
            addans(i);
        }
        printf("%d\n", dp[n]);
    }
    return 0;
}


#include<cstdio>
#include<cstring>
#include<climits>
#include<string>
#include<algorithm>
#include<cmath>
#include<iostream>
#include<queue>
#include<vector>
#include<stack>
#include<map>
#include<set>
#include<stdlib.h>
#include<ctime>
using namespace std;
typedef long long ll;

const int MAXN = 100007;
int que[MAXN], f, r, N;
int a[MAXN], b[MAXN];
ll dp[MAXN];
ll MN;

void addans(int p) {
    if(dp[p] >= MN) return;
    while(f+1 < r) {
        int p1 = que[r-2];
        int p2 = que[r-1];
        if( (dp[p]-dp[p2]) * (-b[p2]+b[p1]) < (dp[p2]-dp[p1]) * (-b[p]+b[p2])) r--;
        else break;
    }
    que[r++] = p;
}

ll getans(int p) {
    while(f+1 < r) {
        int p1 = que[f];
        int p2 = que[f+1];
        if( (dp[p2]-dp[p1]) < a[p]*(-b[p2]+b[p1])) f++;
        else break;
    }
    return dp[que[f]] + b[que[f]]*a[p];
}

int main() {
    //freopen("data.in", "r", stdin);freopen("data1.out", "w", stdout);
    int n;
    while(~scanf("%d", &n)) {
        int i, j;
        for(i = 1; i <= n; i++) scanf("%I64d", a+i);
        for(i = 1; i <= n; i++) scanf("%I64d", b+i);
        dp[1] = f = r = 0;
        MN = b[1]*a[n]; N = n;
        addans(1);
        for(i = 2; i <= n; i++) {
            dp[i] = getans(i);
            addans(i);
        }
        printf("%d\n", dp[n]);
    }
    return 0;
}


#include<cstdio>
#include<cstring>
#include<climits>
#include<string>
#include<algorithm>
#include<cmath>
#include<iostream>
#include<queue>
#include<vector>
#include<stack>
#include<map>
#include<set>
#include<stdlib.h>
#include<ctime>
using namespace std;
typedef long long ll;

const int MAXN = 100007;
int a[MAXN], b[MAXN];
int que[MAXN], f, r;
ll dp[MAXN];

void addans(int p) {
    while(f+1 < r) {
        int p1 = que[r-2];
        int p2 = que[r-1];
        if( (dp[p]-dp[p2]) * (b[p2]-b[p1]) > (dp[p2]-dp[p1]) * (b[p]-b[p2])) r--;
        else break;
    }
    que[r++] = p;
}

ll getans(int p) {
    while(f+1 < r) {
        int p1 = que[f];
        int p2 = que[f+1];
        if( (dp[p2]-dp[p1]) < -a[p]*(b[p2] - b[p1])) f++;
        else break;
    }
    return dp[que[f]] + b[que[f]]*a[p];
}

int main() {
    int n;
    while(~scanf("%d", &n)) {
        int i, j;
        for(i = 1; i <= n; i++) scanf("%d", a+i);
        for(i = 1; i <= n; i++) scanf("%d", b+i);
        dp[1] = f = r = 0;
        addans(1);
        for(i = 2; i <= n; i++) {
            dp[i] = getans(i);
            addans(i);
        }
        printf("%d\n", dp[n]);
    }
    return 0;
}


#include <iostream>
typedef long long ll;

using namespace std;
int n;
int num[100009];
int costos[100009];
ll dp[100009];

int main()
{
    cin >> n;
    for(int i = 0; i < n; i++)
        cin >> num[i];
    for(int i = 0; i < n; i++)
        cin >> costos[i];

    ll m = 100000000000000000;
    dp[1] = costos[0]*num[1];
    for(int i = 2; i < n; i++)
    {
        m = 100000000000000000;
        for(int j = 0; j < i; j++)
        {
            m = min(m,dp[j] + num[i] * costos[j]);
        }
        dp[i] = m;
    }
    cout << dp[n - 1] << endl;
    return 0;
}


#include <iostream>
#include <vector>

using namespace std;

#define maxn 100009
typedef long long ll;

int a[maxn],b[maxn];
ll dp[maxn];
int n;

vector<int>pend;
vector<int>inter;

int pointer;

bool leftt(int l1, int l2, int l3)
{
	return (inter[l1]-inter[l2])*(pend[l3] - pend[l1]) - (inter[l1] - inter[l3])*(pend[l2] - pend[l1]) >= 0;
}

void add(int p, int i)
{
	pend.push_back(p);
	inter.push_back(i);

	while(pend.size() > 2 && leftt(pend.size() - 3, pend.size() - 2,pend.size() - 1))
	{
		pend.erase(pend.end() - 2);
		inter.erase(inter.end() - 2);
	}

}
ll evalua(ll x)
{
	if(pointer > pend.size())
		pointer = pend.size() - 1;
	while(pointer + 1 < pend.size() && pend[pointer + 1]*x + inter[pointer + 1] <=  pend[pointer]*x + inter[pointer])
		pointer++;
	return pend[pointer]*x + inter[pointer];
}

int main()
{
	cin >> n;
	for(int i = 0; i < n; i++)
		cin >> a[i];
	for(int i = 0; i < n; i++)
		cin >> b[i];

	fill(dp, dp + n,1 << 22);

	dp[0] = 0;
	add(b[0],0);
	for(int i = 1; i < n; i++)
	{
		dp[i] = evalua(a[i]);
		add(b[i],dp[i]);
	}
	cout << dp[n - 1] << endl;
	return 0;
}


#include <iostream>
#include <vector>

using namespace std;

#define maxn 100009
typedef long long ll;

int a[maxn],b[maxn];
ll dp[maxn];
int n;

vector<int>pend;
vector<int>inter;

int pointer;

bool leftt(int l1, int l2, int l3)
{
	return (inter[l3] - inter[l1])/(pend[l1] - pend[l3])<= (inter[l2] - inter[l1])/(0. + pend[l1] - pend[l2]) ;
}

void add(int p, int i)
{
	pend.push_back(p);
	inter.push_back(i);

	while(pend.size() > 2 && leftt(pend.size() - 3, pend.size() - 2,pend.size() - 1))
	{
		pend.erase(pend.end() - 2);
		inter.erase(inter.end() - 2);
	}

}
ll evalua(ll x)
{
	if(pointer > pend.size())
		pointer = pend.size() - 1;
	while(pointer + 1 < pend.size() && pend[pointer + 1]*x + inter[pointer + 1] <=  pend[pointer]*x + inter[pointer])
		pointer++;
	return pend[pointer]*x + inter[pointer];
}

int main()
{
	cin >> n;
	for(int i = 0; i < n; i++)
		cin >> a[i];
	for(int i = 0; i < n; i++)
		cin >> b[i];

	fill(dp, dp + n,1 << 22);

	dp[0] = 0;
	add(b[0],0);
	for(int i = 1; i < n; i++)
	{
		dp[i] = evalua(a[i]);
		add(b[i],dp[i]);
	}
	cout << dp[n - 1] << endl;
	return 0;
}


#include <iostream>
#include <vector>

using namespace std;

#define maxn 100009
typedef long long ll;

int a[maxn];
int b[maxn];
vector<ll>m;
vector<ll>n;

int cant;
int pointer;

ll dp[maxn];

bool best(int l1, int l2, int l3)
{
    return (n[l3] - n[l1])*(m[l1] - m[l2]) < (n[l2] - n[l1])*(m[l1] - m[l3]);
}

void add(ll pend, ll inter)
{
    m.push_back(pend);
    n.push_back(inter);
    while(m.size() >= 3 && best(m.size() - 3,m.size() - 2,m.size() - 1))
    {
        m.erase(m.end() - 2);
        n.erase(n.end() - 2);
    }
}

ll evalua(ll x)
{
    if(pointer > m.size() - 1)
        pointer = m.size() - 1;
    while(pointer < m.size() - 1 && m[pointer]*x + n[pointer] > m[pointer + 1]*x + n[pointer + 1])
        pointer++;
    return m[pointer]*x + n[pointer];
}

int main()
{
    cin >> cant;
    for(int i = 0; i < cant; i++)
        cin >> a[i];
    for(int i= 0; i < cant; i++)
        cin >> b[i];

    ll res = 0;
    int tail = 0;
    int head = 0;

    add(b[0],0);
    for(int i = 1; i < cant; i++)
    {
        dp[i] = evalua(a[i]);
        add(b[i],dp[i]);
    }

    cout << dp[cant - 1] << endl;
    return 0;
}


#include <iostream>
#include <vector>

using namespace std;

#define maxn 100009
typedef long long ll;

int a[maxn];
int b[maxn];
vector<ll>m;
vector<ll>n;

int cant;
int pointer;

ll dp[maxn];

bool best(int l1, int l2, int l3)
{
    return (ll)(n[l3] - n[l1])*(m[l1] - m[l2]) <= (ll)(n[l2] - n[l1])*(ll)(m[l1] - m[l3]);
}

void add(ll pend, ll inter)
{
    m.push_back(pend);
    n.push_back(inter);
    while(m.size() >= 3 && best(m.size() - 3,m.size() - 2,m.size() - 1))
    {
        m.erase(m.end() - 2);
        n.erase(n.end() - 2);
    }
}

ll evalua(ll x)
{
    if(pointer > m.size())
        pointer = m.size() - 1;
    while(pointer < m.size() - 1 && (ll)m[pointer]*(ll)x + n[pointer] >= (ll)m[pointer + 1]*(ll)x + n[pointer + 1])
        pointer++;
    return m[pointer]*x + n[pointer];
}

int main()
{
    cin >> cant;
    for(int i = 0; i < cant; i++)
        cin >> a[i];
    for(int i= 0; i < cant; i++)
        cin >> b[i];

    add(b[0],0);
    for(int i = 1; i < cant; i++)
    {
        dp[i] = evalua(a[i]);
        add(b[i],dp[i]);
    }

    cout << dp[cant - 1] << endl;
    return 0;
}


#include <iostream>
#include <vector>

using namespace std;

#define maxn 100009
typedef long long ll;

int a[maxn];
int b[maxn];
vector<ll>m;
vector<ll>n;

int cant;
int pointer;

ll dp[maxn];

bool best(int l1, int l2, int l3)
{
    return (ll)(n[l3] - n[l1])*(m[l1] - m[l2]) <= (ll)(n[l2] - n[l1])*(ll)(m[l1] - m[l3]);
}

void add(ll pend, ll inter)
{
    m.push_back(pend);
    n.push_back(inter);
    while(m.size() >= 3 && best(m.size() - 3,m.size() - 2,m.size() - 1))
    {
        m.erase(m.end() - 2);
        n.erase(n.end() - 2);
    }
}

ll evalua(ll x)
{
    if(pointer > m.size())
        pointer = m.size() - 1;
    while(pointer < m.size() - 1 && m[pointer]*x + n[pointer] >= m[pointer + 1]*x + n[pointer + 1])
        pointer++;
    return m[pointer]*x + n[pointer];
}

int main()
{
    cin >> cant;
    for(int i = 0; i < cant; i++)
        cin >> a[i];
    for(int i= 0; i < cant; i++)
        cin >> b[i];

    add(b[0],0);
    for(int i = 1; i < cant; i++)
    {
        dp[i] = evalua(a[i]);
        add(b[i],dp[i]);
    }

    cout << dp[cant - 1] << endl;
    return 0;
}


#include <iostream>
#include <vector>

using namespace std;

#define maxn 100009
typedef long long ll;

int a[maxn];
int b[maxn];
vector<ll>m;
vector<ll>n;

int cant;
int pointer;

ll dp[maxn];

bool best(int l1, int l2, int l3)
{
	return (ll)(n[l3] - n[l1])*(m[l1] - m[l2]) <= (ll)(n[l2] - n[l1])*(ll)(m[l1] - m[l3]);
}

void add(ll pend, ll inter)
{
	m.push_back(pend);
	n.push_back(inter);
	while(m.size() >= 3 && best(m.size() - 3,m.size() - 2,m.size() - 1))
	{
		m.erase(m.end() - 2);
		n.erase(n.end() - 2);
	}
}

ll evalua(ll x)
{
	if(pointer > m.size() - 1)
		pointer = m.size() - 1;
	while(pointer < m.size() - 1 && m[pointer]*x + n[pointer] >= m[pointer + 1]*x + n[pointer + 1])
		pointer++;
	return m[pointer]*x + n[pointer];
}

int main()
{
	cin >> cant;
	for(int i = 0; i < cant; i++)
		cin >> a[i];
	for(int i= 0; i < cant; i++)
		cin >> b[i];

	add(b[0],0);
	for(int i = 1; i < cant; i++)
	{
		dp[i] = evalua(a[i]);
		add(b[i],dp[i]);
	}

	cout << dp[cant - 1] << endl;
	return 0;
}


#include <iostream>
#include <vector>

using namespace std;

#define maxn 100009
typedef long long ll;

int a[maxn];
int b[maxn];
vector<ll>m;
vector<ll>n;

int cant;
int pointer;

ll dp[maxn];

bool best(int l1, int l2, int l3)
{
    return (ll)(n[l3] - n[l1])*(m[l1] - m[l2]) <= (ll)(n[l2] - n[l1])*(ll)(m[l1] - m[l3]);
}

void add(ll pend, ll inter)
{
    m.push_back(pend);
    n.push_back(inter);
    while(m.size() >= 3 && best(m.size() - 3,m.size() - 2,m.size() - 1))
    {
        m.erase(m.end() - 2);
        n.erase(n.end() - 2);
    }
}

ll evalua(ll x)
{
    if(pointer > m.size() - 1)
        pointer = m.size() - 1;
    while(pointer < m.size() - 1 && m[pointer]*x + n[pointer] > m[pointer + 1]*x + n[pointer + 1])
        pointer++;
    return m[pointer]*x + n[pointer];
}

int main()
{
    cin >> cant;
    for(int i = 0; i < cant; i++)
        cin >> a[i];
    for(int i= 0; i < cant; i++)
        cin >> b[i];

    add(b[0],0);
    for(int i = 1; i < cant; i++)
    {
        dp[i] = evalua(a[i]);
        add(b[i],dp[i]);
    }

    cout << dp[cant - 1] << endl;
    return 0;
}


#include <iostream>
#include <vector>

using namespace std;

#define maxn 100009
typedef long long ll;

int a[maxn],b[maxn];
ll dp[maxn];
int n;

vector<ll>pend;
vector<ll>inter;

int pointer;

bool leftt(int l1, int l2, int l3)
{
	return (inter[l3] - inter[l1])/(pend[l1] - pend[l3])<= (inter[l2] - inter[l1])/(0. + pend[l1] - pend[l2]) ;
}

void add(ll p, ll i)
{
	pend.push_back(p);
	inter.push_back(i);

	while(pend.size() > 2 && leftt(pend.size() - 3, pend.size() - 2,pend.size() - 1))
	{
		pend.erase(pend.end() - 2);
		inter.erase(inter.end() - 2);
	}

}
ll evalua(ll x)
{
	if(pointer > pend.size())
		pointer = pend.size() - 1;
	while(pointer + 1 < pend.size() && (ll)pend[pointer + 1]*x + (ll)inter[pointer + 1] <=  (ll)pend[pointer]*x + (ll)inter[pointer])
		pointer++;
	return (ll)pend[pointer]*(ll)x + (ll)inter[pointer];
}

int main()
{
	cin >> n;
	for(int i = 0; i < n; i++)
		cin >> a[i];
	for(int i = 0; i < n; i++)
		cin >> b[i];

	fill(dp, dp + n,1 << 22);

	dp[0] = 0;
	add(b[0],0);
	for(int i = 1; i < n; i++)
	{
		dp[i] = evalua(a[i]);
		add(b[i],dp[i]);
	}
	cout << dp[n - 1] << endl;
	return 0;
}


#include <iostream>
#include <vector>

using namespace std;

#define maxn 100009
typedef long long ll;

int a[maxn];
int b[maxn];
vector<ll>m;
vector<ll>n;

int cant;
int pointer;

ll dp[maxn];

bool best(int l1, int l2, int l3)
{
    return (n[l3] - n[l1])/(m[l1] - m[l3])<= (n[l2] - n[l1])/(0. + m[l1] - m[l2]) ;
}

void add(ll pend, ll inter)
{
    m.push_back(pend);
    n.push_back(inter);
    while(m.size() >= 3 && best(m.size() - 3,m.size() - 2,m.size() - 1))
    {
        m.erase(m.end() - 2);
        n.erase(n.end() - 2);
    }
}

ll evalua(ll x)
{
    if(pointer > m.size())
        pointer = m.size() - 1;
    while(pointer < m.size() - 1 && (ll)m[pointer]*(ll)x + n[pointer] >= (ll)m[pointer + 1]*(ll)x + n[pointer + 1])
        pointer++;
    return m[pointer]*x + n[pointer];
}

int main()
{
    cin >> cant;
    for(int i = 0; i < cant; i++)
        cin >> a[i];
    for(int i= 0; i < cant; i++)
        cin >> b[i];

    add(b[0],0);
    for(int i = 1; i < cant; i++)
    {
        dp[i] = evalua(a[i]);
        add(b[i],dp[i]);
    }

    cout << dp[cant - 1] << endl;
    return 0;
}


#include <iostream>
#include <algorithm>
using namespace std;

typedef long long ll;

struct par{
	ll x,y;
};

int n,i,b;
ll dp[100123],z;

par zig[100123];

int main(){

cin>>n;

for(i=1;i<=n;i++)cin>>zig[i].x;
for(i=1;i<=n;i++)cin>>zig[i].y;

dp[1] = 0;
b=1;

for(i=2;i<=n;i++){
	for(;b<i-1;){

		if( dp[b+1] + zig[b+1].y*zig[i].x < dp[b] + zig[b].y*zig[i].x ){
			b++;
		}
		else break;

	}

	dp[i] = dp[b] + zig[b].y*zig[i].x;
}

	cout<<dp[n]<<endl;
    return 0;
}

/*

5
1 2 3 4 5
5 4 3 2 0

6
1 2 3 10 20 30
6 5 4 3 2 0

*/


#include <cstdio>
#include <iostream>
#include <vector>
using namespace std;
typedef long long ll;

int n,i;
ll a[100123],b[100123];
ll reza,dp[100123];

struct prav{
	ll k,c;

	prav( ll ik , ll ic ){
		k=ik,c=ic;
	}

};

vector <prav> v;

double sjek( ll k1 , ll b1 , ll k2 , ll b2 ){
	return (double)((b2-b1)/(k1-k2));
}

int main(){

	scanf("%d",&n);

	for(i=0;i<n;i++)scanf("%d",&a[i]);
	for(i=0;i<n;i++)scanf("%d",&b[i]);

	v.push_back( prav( b[0] , 0 ) );
	int h=0,sz;
	for( i=1;i<n;i++ ){

		while( v.size()-h >= 2  && sjek( v[h].k , v[h].c , v[h+1].k , v[h+1].c  ) < (double)a[i] )++h;

		dp[i]=v[h].c + v[h].k*a[i];
		sz=v.size();

		while( v.size()-h >= 2  && sjek( v[sz-1].k , v[sz-1].c , b[i] , dp[i]  ) > (double)a[i] )v.pop_back(),sz--;

		v.push_back( prav( b[i] , dp[i] ) );
	}

	reza=v[v.size()-1].c;
    printf("%I64d\n",reza);
    return 0;
}

/*

5
1 2 3 4 5
5 4 3 2 0

6
1 2 3 10 20 30
6 5 4 3 2 0

*/


#include <cstdio>
#include <iostream>
#include <vector>
using namespace std;
typedef long long ll;

int n,i;
ll a[100123],b[100123];
ll reza,dp[100123];

struct prav{
	ll k,c;

	prav( ll ik , ll ic ){
		k=ik,c=ic;
	}

};

vector <prav> v;

double sjek( ll k1 , ll b1 , ll k2 , ll b2 ){
	return (double)((b2-b1)/(k1-k2));
}

int main(){

	scanf("%d",&n);

	for(i=0;i<n;i++)scanf("%d",&a[i]);
	for(i=0;i<n;i++)scanf("%d",&b[i]);

	v.push_back( prav( b[0] , 0 ) );
	int h=0;
	for( i=1;i<n;i++ ){
		while( v.size()-h >= 2  && sjek( v[h].k , v[h].c , v[h+1].k , v[h+1].c  ) < (double)a[i] )++h;

	/*	cout<<"tararatatraratara "<<h<<endl;
		dp[i]=v[h].c + v[h].k*a[i];
		cout<<dp[i]<<endl;*/
		v.push_back( prav( b[i] , v[h].c + v[h].k*a[i] ) );
	}

	reza=v[v.size()-1].c;
    printf("%I64d\n",reza);
    return 0;
}

/*

5
1 2 3 4 5
5 4 3 2 0

6
1 2 3 10 20 30
6 5 4 3 2 0

*/


#include <iostream>
#include <algorithm>
using namespace std;

typedef long long ll;

struct par{
	ll x,y;
};

int n,i,b;
ll dp[100123];

par zig[100123];

int main(){

cin>>n;

for(i=1;i<=n;i++)cin>>zig[i].x;
for(i=1;i<=n;i++)cin>>zig[i].y;

dp[1] = 0;
b=1;

for(i=2;i<=n;i++){
	for(;b<i-1;){

		if( dp[b+1] + zig[b+1].y*zig[i].x < dp[b] + zig[b].y*zig[i].x )b++;
		else break;

	}

	dp[i] = dp[b] + zig[b].y*zig[i].x;
	if(dp[i]<0)cout<<"koji kurac"<<endl;
}

	cout<<dp[n]<<endl;
    return 0;
}

/*

5
1 2 3 4 5
5 4 3 2 0

6
1 2 3 10 20 30
6 5 4 3 2 0

*/


#include <cstdio>
#include <iostream>
#include <vector>
using namespace std;
typedef long long ll;

int n,i;
ll a[100123],b[100123];
ll reza,dp[100123];

struct prav{
	ll k,c;

	prav( ll ik , ll ic ){
		k=ik,c=ic;
	}

};

vector <prav> v;

ll sjek( ll k1 , ll b1 , ll k2 , ll b2 ){
	return (b2-b1)/(k1-k2);
}

int main(){

	scanf("%d",&n);

	for(i=0;i<n;i++)scanf("%d",&a[i]);
	for(i=0;i<n;i++)scanf("%d",&b[i]);

	v.push_back( prav( b[0] , 0 ) );
	int h=0;
	for( i=1;i<n;i++ ){
		while( v.size()-h >= 2  && sjek( v[h].k , v[h].c , v[h+1].k , v[h+1].c  ) < a[i] )++h;

	/*	cout<<"tararatatraratara "<<h<<endl;
		dp[i]=v[h].c + v[h].k*a[i];
		cout<<dp[i]<<endl;*/
		v.push_back( prav( b[i] , v[h].c + v[h].k*a[i] ) );
	}

	reza=v[v.size()-1].c;
    printf("%I64d\n",reza);
    return 0;
}

/*

5
1 2 3 4 5
5 4 3 2 0

6
1 2 3 10 20 30
6 5 4 3 2 0

*/


#include <cstdio>
#include <iostream>
#include <vector>
using namespace std;
typedef long long ll;

int n,i;
ll a[100123],b[100123],dp[100123];

struct prav{
	ll k,c;

	prav( ll ik , ll ic ){
		k=ik,c=ic;
	}

};

vector <prav> v;

double sjek( double k1 , double b1 , double k2 , double b2 ){
	return (double)((b2-b1)/(k1-k2));
}

int main(){

	scanf("%d",&n);

	for(i=0;i<n;i++)scanf("%d",&a[i]);
	for(i=0;i<n;i++)scanf("%d",&b[i]);

	v.push_back( prav( b[0] , 0 ) );
	int h=0,sz;

	for( i=1;i<n;i++ ){

		while( v.size()-h >= 2  && sjek( v[h].k , v[h].c , v[h+1].k , v[h+1].c  ) < (double)a[i] )++h;

		dp[i]=v[h].c + v[h].k*a[i];
		sz=v.size();

		while( v.size()-h >= 2  && sjek( v[sz-1].k , v[sz-1].c , b[i] , dp[i]  ) > (double)a[i] )v.pop_back(),sz--;

		v.push_back( prav( b[i] , dp[i] ) );
	}

    printf("%I64d\n",dp[n-1]);
    return 0;
}

/*

5
1 2 3 4 5
5 4 3 2 0

6
1 2 3 10 20 30
6 5 4 3 2 0

*/


#include <cstdio>
#include <iostream>
#include <vector>
using namespace std;
typedef long long ll;

int n,i;
ll a[100123],b[100123],dp[100123];

struct prav{
	ll k,c;

	prav( ll ik , ll ic ){
		k=ik,c=ic;
	}

};

vector <prav> v;

int main(){

	scanf("%d",&n);

	for(i=0;i<n;i++)scanf("%d",&a[i]);
	for(i=0;i<n;i++)scanf("%d",&b[i]);

	v.push_back( prav( b[0] , 0 ) );
	int h=0,sz;

	for( i=1;i<n;i++ ){

		while( v.size()-h >= 2  &&  (v[h].c - v[h+1].c)/(v[h+1].k - v[h].k)  < a[i] )++h;

		dp[i]=v[h].c + v[h].k*a[i];
		sz=v.size();

		while( v.size()-h >= 2  &&  (v[sz-1].c - dp[i])/( b[i] - v[sz-1].k ) <= (v[sz-2].c - v[sz-1].c)/( v[sz-1].k - v[sz-2].k ) )v.pop_back(),sz--;

		v.push_back( prav( b[i] , dp[i] ) );
	}

    printf("%I64d\n",dp[n-1]);
    return 0;
}

/*

5
1 2 3 4 5
5 4 3 2 0

6
1 2 3 10 20 30
6 5 4 3 2 0

*/


#include <cstdio>
#include <iostream>
#include <vector>
using namespace std;
typedef long long ll;

int n,i;
ll a[100123],b[100123],dp[100123];

struct prav{
	ll k,c;

	prav( ll ik , ll ic ){
		k=ik,c=ic;
	}

};

vector <prav> v;

double sjek( double k1 , double b1 , double k2 , double b2 ){
	return (double)((b2-b1)/(k1-k2));
}

int main(){

	scanf("%d",&n);

	for(i=0;i<n;i++)scanf("%d",&a[i]);
	for(i=0;i<n;i++)scanf("%d",&b[i]);

	v.push_back( prav( b[0] , 0 ) );
	int h=0,sz;

	for( i=1;i<n;i++ ){

		while( v.size()-h >= 2  &&  (v[h].c - v[h+1].c)/(v[h+1].k - v[h].k)  < a[i] )++h;

		dp[i]=v[h].c + v[h].k*a[i];
		sz=v.size();

		while( v.size()-h >= 2  && sjek( v[sz-1].k , v[sz-1].c , b[i] , dp[i]  ) > (double)a[i] )v.pop_back(),sz--;

		v.push_back( prav( b[i] , dp[i] ) );
	}

    printf("%I64d\n",dp[n-1]);
    return 0;
}

/*

5
1 2 3 4 5
5 4 3 2 0

6
1 2 3 10 20 30
6 5 4 3 2 0

*/


#include <iostream>
#include <algorithm>
using namespace std;

typedef long long ll;

struct par{
	ll x,y;
};

int n,i,b;
ll dp[100123];

par zig[100123];

int main(){

cin>>n;

for(i=1;i<=n;i++)cin>>zig[i].x;
for(i=1;i<=n;i++)cin>>zig[i].y;

dp[1] = 0;
b=1;

for(i=2;i<=n;i++){
	for(;b<i-1;){

		if( dp[b+1] + zig[b+1].y*zig[i].x < dp[b] + zig[b].y*zig[i].x ){
			b++;
		}
		else break;

	}

	dp[i] = dp[b] + zig[b].y*zig[i].x;
}

	cout<<dp[n]<<endl;
    return 0;
}

/*

5
1 2 3 4 5
5 4 3 2 0

6
1 2 3 10 20 30
6 5 4 3 2 0

*/


#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int MAXN=100000;
ll a[MAXN+5],b[MAXN+5],dp[MAXN+5];
int N;
vector<pair<ll,ll> >lines; // first: slope(b[j])  second: C (dp[j])
ll start[MAXN+5];

int bin_search(int ind){

    int lo=0,hi=(int)lines.size()-1,mid;
    mid=(lo+hi)/2;
    ll x=a[ind];
    while(lo<=hi){
        if((x>=start[mid]) && (mid==(int)lines.size()-1 || x<=start[mid+1] )  ){
              return mid;
        }

        else if(x>=start[mid]){
            lo=mid+1;
        }
        else {
            hi=mid-1;
        }
        mid=(lo+hi)/2;
    }
}
int main(){
    cin>>N;
    for(int i=0;i<N;i++)cin>>a[i];
    for(int i=0;i<N;i++)cin>>b[i];

    lines.push_back(make_pair(b[0],dp[0]));
    for(int i=1;i<N;i++){

        int j=bin_search(i);
        dp[i]= dp[j]+b[j]*a[i];

   //for(int j=0;j<i;j++)dp[i]=min(dp[i],dp[j]+b[j]*a[i]);

        lines.push_back(make_pair(b[i],dp[i]));

        ll m1=lines[i-1].first;
        ll c1=lines[i-1].second;
        ll m2=lines[i].first;
        ll c2=lines[i].second;

        double d=(double)(c2-c1)/(double)(m1-m2);
        ll l=d;
        if(d>(double)l)l++;
        start[i]=l;

        if(i==1)start[0]=start[i]-1;

        //start[(int)lines.size()-1]= ceil( (c2-c1)/(m1-m2) );

    }
    cout<<dp[N-1]<<"\n";
}


#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int MAXN=100000;
ll a[MAXN+5],b[MAXN+5],dp[MAXN+5];
int N;
vector<pair<ll,ll> >lines; // first: slope(b[j])  second: C (dp[j])
ll start[MAXN+5];

int bin_search(int ind){

    int lo=0,hi=(int)lines.size()-1,mid;
    mid=(lo+hi)/2;
    ll x=a[ind];
    while(lo<=hi){
        if(x>=start[mid] && (mid==(int)lines.size()-1 || x<=start[mid+1] )  ){
              return mid;
        }

        else if(x>=start[mid]){
            lo=mid+1;
        }
        else {
            hi=mid-1;
        }
        mid=(lo+hi)/2;
    }
}
int main(){
    cin>>N;
    for(int i=0;i<N;i++)cin>>a[i];
    for(int i=0;i<N;i++)cin>>b[i];

    lines.push_back(make_pair(b[0],dp[0]));
    start[0]=-1;
    for(int i=1;i<N;i++){

        int j=bin_search(i);
        dp[i]= dp[j]+b[j]*a[i];
        //for(int j=0;j<i;j++)dp[i]=min(dp[i],dp[j]+b[j]*a[i]);

        lines.push_back(make_pair(b[i],dp[i]));
        ll m1=lines[(int)lines.size()-2].first;
        ll c1=lines[(int)lines.size()-2].second;
        ll m2=lines[(int)lines.size()-1].first;
        ll c2=lines[(int)lines.size()-1].second;

        double d=(c2-c1)/(m1-m2);
        ll l=d;
        if(d>l)l++;
        start[(int)lines.size()-1]=l;

        //start[(int)lines.size()-1]= ceil( (c2-c1)/(m1-m2) );

    }
    cout<<dp[N-1]<<"\n";
}


#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int MAXN=100000;
ll a[MAXN+5],b[MAXN+5],dp[MAXN+5];
int N;
vector<pair<ll,ll> >lines; // first: slope(b[j])  second: C (dp[j])
ll start[MAXN+5];

int bin_search(int ind){

    int lo=0,hi=(int)lines.size()-1,mid;
    mid=(lo+hi)/2;
    ll x=a[ind];
    while(lo<=hi){
        if(x>=start[mid] && (mid==(int)lines.size()-1 || x<=start[mid+1] )  ){
              return mid;
        }

        else if(x>=start[mid]){
            lo=mid+1;
        }
        else {
            hi=mid-1;
        }
        mid=(lo+hi)/2;
    }
}
int main(){
    cin>>N;
    for(int i=0;i<N;i++)cin>>a[i];
    for(int i=0;i<N;i++)cin>>b[i];

    lines.push_back(make_pair(b[0],dp[0]));
    start[0]=-1;
    for(int i=1;i<N;i++){

        int j=bin_search(i);
        dp[i]= dp[j]+b[j]*a[i];
        //for(int j=0;j<i;j++)dp[i]=min(dp[i],dp[j]+b[j]*a[i]);

        lines.push_back(make_pair(b[i],dp[i]));
        ll m1=lines[(int)lines.size()-2].first;
        ll c1=lines[(int)lines.size()-2].second;
        ll m2=lines[(int)lines.size()-1].first;
        ll c2=lines[(int)lines.size()-1].second;

        double d=(double)(c2-c1)/(m1-m2);
        ll l=d;
        if(d>l)l++;
        start[(int)lines.size()-1]=l;

        //start[(int)lines.size()-1]= ceil( (c2-c1)/(m1-m2) );

    }
    cout<<dp[N-1]<<"\n";
}


#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int MAXN=100000;
ll a[MAXN+5],b[MAXN+5],dp[MAXN+5];
int N;
vector<pair<ll,ll> >lines; // first: slope(b[j])  second: C (dp[j])
ll start[MAXN+5];

int bin_search(int ind){

    int lo=0,hi=(int)lines.size()-1,mid;
    mid=(lo+hi)/2;
    ll x=a[ind];
    while(lo<=hi){
        if(x>=start[mid] && (mid==(int)lines.size() || x<=start[mid+1] )  ){
              return mid;
        }

        else if(x>=start[mid]){
            lo=mid+1;
        }
        else {
            hi=mid-1;
        }
        mid=(lo+hi)/2;
    }
}
int main(){
    cin>>N;
    for(int i=0;i<N;i++)cin>>a[i];
    for(int i=0;i<N;i++)cin>>b[i];

    lines.push_back(make_pair(b[0],dp[0]));
    start[0]=-1;
    for(int i=1;i<N;i++){

        int j=bin_search(i);
        dp[i]= dp[j]+b[j]*a[i];
        //for(int j=0;j<i;j++)dp[i]=min(dp[i],dp[j]+b[j]*a[i]);

        lines.push_back(make_pair(b[i],dp[i]));
        ll m1=lines[(int)lines.size()-2].first;
        ll c1=lines[(int)lines.size()-2].second;
        ll m2=lines[(int)lines.size()-1].first;
        ll c2=lines[(int)lines.size()-1].second;
        start[(int)lines.size()-1]=ceil( (c2-c1)/(m1-m2) );

    }
    cout<<dp[N-1];
}


#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int MAXN=100000;
ll a[MAXN+5],b[MAXN+5],dp[MAXN+5];
int N;
vector<pair<ll,ll> >lines; // first: slope(b[j])  second: C (dp[j])
ll start[MAXN+5];

int bin_search(int ind){

    int lo=0,hi=(int)lines.size()-1,mid;
    mid=(lo+hi)/2;
    ll x=a[ind];
    while(lo<=hi){
        if(x>=start[mid] && (mid==(int)lines.size()-1 || x<=start[mid+1] )  ){
              return mid;
        }

        else if(x>=start[mid]){
            lo=mid+1;
        }
        else {
            hi=mid-1;
        }
        mid=(lo+hi)/2;
    }
}
int main(){
    cin>>N;
    for(int i=0;i<N;i++)cin>>a[i];
    for(int i=0;i<N;i++)cin>>b[i];

    lines.push_back(make_pair(b[0],dp[0]));
    start[0]=-10000000000;
    for(int i=1;i<N;i++){

        int j=bin_search(i);
        dp[i]= dp[j]+b[j]*a[i];

   //for(int j=0;j<i;j++)dp[i]=min(dp[i],dp[j]+b[j]*a[i]);

        lines.push_back(make_pair(b[i],dp[i]));
        ll m1=lines[(int)lines.size()-2].first;
        ll c1=lines[(int)lines.size()-2].second;
        ll m2=lines[(int)lines.size()-1].first;
        ll c2=lines[(int)lines.size()-1].second;

        double d=(double)(c2-c1)/(double)(m1-m2);
        ll l=d;
        if(d>(double)l)l++;
        start[(int)lines.size()-1]=l;

        //start[(int)lines.size()-1]= ceil( (c2-c1)/(m1-m2) );

    }
    cout<<dp[N-1]<<"\n";
}


#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int MAXN=100000;
ll a[MAXN+5],b[MAXN+5],dp[MAXN+5];
int N;
vector<pair<ll,ll> >lines; // first: slope(b[j])  second: C (dp[j])
ll start[MAXN+5];

int bin_search(int ind){

    int lo=0,hi=(int)lines.size()-1,mid;
    mid=(lo+hi)/2;
    ll x=a[ind];
    while(lo<=hi){
        if(x>=start[mid] && (mid==(int)lines.size()-1 || x<=start[mid+1] )  ){
              return mid;
        }

        else if(x>=start[mid]){
            lo=mid+1;
        }
        else {
            hi=mid-1;
        }
        mid=(lo+hi)/2;
    }
}
int main(){
    cin>>N;
    for(int i=0;i<N;i++)cin>>a[i];
    for(int i=0;i<N;i++)cin>>b[i];

    lines.push_back(make_pair(b[0],dp[0]));
    start[0]=-1;
    for(int i=1;i<N;i++){

        int j=bin_search(i);
        dp[i]= dp[j]+b[j]*a[i];
        //for(int j=0;j<i;j++)dp[i]=min(dp[i],dp[j]+b[j]*a[i]);

        lines.push_back(make_pair(b[i],dp[i]));
        ll m1=lines[(int)lines.size()-2].first;
        ll c1=lines[(int)lines.size()-2].second;
        ll m2=lines[(int)lines.size()-1].first;
        ll c2=lines[(int)lines.size()-1].second;

        double d=(double)(c2-c1)/(double)(m1-m2);
        ll l=d;
        if(d>(double)l)l++;
        start[(int)lines.size()-1]=l;

        //start[(int)lines.size()-1]= ceil( (c2-c1)/(m1-m2) );

    }
    cout<<dp[N-1]<<"\n";
}


#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int MAXN=100000;
ll a[MAXN+5],b[MAXN+5],dp[MAXN+5];
int N;
vector<pair<ll,ll> >lines; // first: slope(b[j])  second: C (dp[j])
ll start[MAXN+5];

int bin_search(int ind){

    int lo=0,hi=(int)lines.size()-1,mid;
    mid=(lo+hi)/2;
    int x=a[ind];
    while(lo<=hi){
        if(x>=start[mid] && (mid==(int)lines.size() || x<=start[mid+1] )  ){
              return mid;
        }

        else if(x>=start[mid]){
            lo=mid+1;
        }
        else {
            hi=mid-1;
        }
        mid=(lo+hi)/2;
    }
}
int main(){
    cin>>N;
    for(int i=0;i<N;i++)cin>>a[i];
    for(int i=0;i<N;i++)cin>>b[i];

    lines.push_back(make_pair(b[0],dp[0]));
    start[0]=-1;
    for(int i=1;i<N;i++){

        int j=bin_search(i);
        dp[i]= dp[j]+b[j]*a[i];
        //for(int j=0;j<i;j++)dp[i]=min(dp[i],dp[j]+b[j]*a[i]);

        lines.push_back(make_pair(b[i],dp[i]));
        ll m1=lines[(int)lines.size()-2].first;
        ll c1=lines[(int)lines.size()-2].second;
        ll m2=lines[(int)lines.size()-1].first;
        ll c2=lines[(int)lines.size()-1].second;
        start[(int)lines.size()-1]=ceil( (c2-c1)/(m1-m2) );

    }
    cout<<dp[N-1];
}


#include <bits/stdc++.h>

const int N = 1e6 + 5;
int mx[N][20], mn[N][20];
int best[N];
int n, k;

void build_max()	{
	for (int j=1; (1<<j)<=n; ++j)	{
		for (int i=1; i+(1<<j)-1<=n; ++i)	{
			mx[i][j] = std::max (mx[i][j-1], mx[i+(1<<j)][j-1]);
		}
	}
}
int query_max(int l, int r)	{
	int k = 0;	while (1<<(k+1) <= r-l+1)	++k;
	return std::max (mx[l][k], mx[r-(1<<k)+1][k]);
}

void build_min()	{
	for (int j=1; (1<<j)<=n; ++j)	{
		for (int i=1; i+(1<<j)-1<=n; ++i)	{
			mn[i][j] = std::min (mn[i][j-1], mn[i+(1<<j)][j-1]);
		}
	}
}
int query_min(int l, int r)	{
	int k = 0;	while (1<<(k+1) <= r-l+1)	++k;
	return std::min (mn[l][k], mn[r-(1<<k)+1][k]);
}

int p(int l, int r)	{
	if (l < 0 || r >= n)	return -1;
	return std::min (100 * query_max (l, r), query_min (l, r));
}

int main()	{
	scanf ("%d%d", &n, &k);
	for (int i=0; i<n; ++i)	{
		scanf ("%d", &mx[i][0]);
	}
	build_max ();
	for (int i=0; i<n; ++i)	{
		scanf ("%d", &mn[i][0]);
	}
	build_min ();
	for (int i=0; i<n; ++i)	{
		int low = i, high = n - 1;
		while (low + 1 < high)	{
			int mid = low + high >> 1;
			int v1 = 100 * query_max (i, mid);
			int v2 = query_min (i, mid);
			if (v1 < v2)	low = mid;
			else	high = mid;
		}
		best[i] = std::max (p (i, low), p (i, high));
	}
	std::sort (best, best+n);
	double prob = 1.0;
	for (int i=1; i<=k; ++i)	{
		prob = prob / (n - i + 1) * i;
	}
	double ans = prob * best[n-k];
	int a = k - 1, b = 0;
	for (int i=n-k-1; i>=0; --i)	{
		a++;	b++;
		prob = prob / b * a;
		ans += prob * best[i];
	}
	printf ("%.12f\n", ans);

	return 0;
}


#include <bits/stdc++.h>

const int N = 1e6 + 5;
int mx[N][20], mn[N][20];
int best[N];
int n, k;

void build_max()	{
	for (int j=1; (1<<j)<=n; ++j)	{
		for (int i=1; i+(1<<j)-1<=n; ++i)	{
			mx[i][j] = std::max (mx[i][j-1], mx[i+(1<<j)][j-1]);
		}
	}
}
int query_max(int l, int r)	{
	int k = 0;	while (1<<(k+1) <= r-l+1)	++k;
	return std::max (mx[l][k], mx[r-(1<<k)+1][k]);
}

void build_min()	{
	for (int j=1; (1<<j)<=n; ++j)	{
		for (int i=1; i+(1<<j)-1<=n; ++i)	{
			mn[i][j] = std::min (mn[i][j-1], mn[i+(1<<j)][j-1]);
		}
	}
}
int query_min(int l, int r)	{
	int k = 0;	while (1<<(k+1) <= r-l+1)	++k;
	return std::min (mn[l][k], mn[r-(1<<k)+1][k]);
}

int p(int l, int r)	{
	if (l > r || l < 1 || r > n)	return 0;
	return std::min (100 * query_max (l, r), query_min (l, r));
}

int main()	{
	scanf ("%d%d", &n, &k);
	for (int i=1; i<=n; ++i)	{
		scanf ("%d", &mx[i][0]);
	}
	build_max ();
	for (int i=1; i<=n; ++i)	{
		scanf ("%d", &mn[i][0]);
	}
	build_min ();
	for (int i=1; i<=n; ++i)	{
		int low = i - 1, high = n + 1;
		while (low + 1 < high)	{
			int mid = low + high >> 1;
			int v1 = 100 * query_max (i, mid);
			int v2 = query_min (i, mid);
			if (v1 < v2)	low = mid;
			else	high = mid;
		}
		best[i] = std::max (p (i, low), p (i, high));
	}
	std::sort (best+1, best+1+n);
	double prob = 1.0 * k / n;
	double ans = prob * best[1];
	for (int i=2; i<=n-k+1; ++i)	{
		prob = prob * (n - i - k + 1 + 1) / (n - i + 1);
		ans += prob * best[i];
	}
	printf ("%.12f\n", ans);

	return 0;
}


#include <bits/stdc++.h>

const int N = 1e6 + 5;
int mx[N][20], mn[N][20];
int best[N];
int n, k;

void build_max()	{
	for (int j=1; (1<<j)<=n; ++j)	{
		for (int i=1; i+(1<<j)-1<=n; ++i)	{
			mx[i][j] = std::max (mx[i][j-1], mx[i+(1<<j)][j-1]);
		}
	}
}
int query_max(int l, int r)	{
	int k = 0;	while (1<<(k+1) <= r-l+1)	++k;
	return std::max (mx[l][k], mx[r-(1<<k)+1][k]);
}

void build_min()	{
	for (int j=1; (1<<j)<=n; ++j)	{
		for (int i=1; i+(1<<j)-1<=n; ++i)	{
			mn[i][j] = std::min (mn[i][j-1], mn[i+(1<<j)][j-1]);
		}
	}
}
int query_min(int l, int r)	{
	int k = 0;	while (1<<(k+1) <= r-l+1)	++k;
	return std::min (mn[l][k], mn[r-(1<<k)+1][k]);
}

int p(int l, int r)	{
	if (l < 0 || r >= n)	return -1;
	return std::min (100 * query_max (l, r), query_min (l, r));
}

int main()	{
	scanf ("%d%d", &n, &k);
	for (int i=0; i<n; ++i)	{
		scanf ("%d", &mx[i][0]);
	}
	build_max ();
	for (int i=0; i<n; ++i)	{
		scanf ("%d", &mn[i][0]);
	}
	build_min ();
	for (int i=0; i<n; ++i)	{
		int low = i, high = n - 1;
		while (low + 1 < high)	{
			int mid = low + high >> 1;
			int v1 = 100 * query_max (i, mid);
			int v2 = query_min (i, mid);
			if (v1 < v2)	low = mid;
			else	high = mid;
		}
		best[i] = std::max (p (i, low), p (i, high));
	}
	std::sort (best, best+n);
	double prob = 1.0;
	for (int i=1; i<=k; ++i)	{
		prob = prob * i / (n - i + 1);
	}
	double ans = prob * best[n-k];
	int a = k - 1, b = 0;
	for (int i=n-k-1; i>=0; --i)	{
		a++;	b++;
		prob = prob * a / b;
		ans += prob * best[i];
	}
	printf ("%.12f\n", ans);

	return 0;
}


#pragma GCC optimize(2)
#pragma GCC optimize(3,"Ofast","inline")
#pragma GCC optimize("Ofast")
#pragma GCC optimize("inline")
#pragma GCC optimize("-fgcse")
#pragma GCC optimize("-fgcse-lm")
#pragma GCC optimize("-fipa-sra")
#pragma GCC optimize("-ftree-pre")
#pragma GCC optimize("-ftree-vrp")
#pragma GCC optimize("-fpeephole2")
#pragma GCC optimize("-ffast-math")
#pragma GCC optimize("-fsched-spec")
#pragma GCC optimize("unroll-loops")
#pragma GCC optimize("-falign-jumps")
#pragma GCC optimize("-falign-loops")
#pragma GCC optimize("-falign-labels")
#pragma GCC optimize("-fdevirtualize")
#pragma GCC optimize("-fcaller-saves")
#pragma GCC optimize("-fcrossjumping")
#pragma GCC optimize("-fthread-jumps")
#pragma GCC optimize("-funroll-loops")
#pragma GCC optimize("-fwhole-program")
#pragma GCC optimize("-freorder-blocks")
#pragma GCC optimize("-fschedule-insns")
#pragma GCC optimize("inline-functions")
#pragma GCC optimize("-ftree-tail-merge")
#pragma GCC optimize("-fschedule-insns2")
#pragma GCC optimize("-fstrict-aliasing")
#pragma GCC optimize("-fstrict-overflow")
#pragma GCC optimize("-falign-functions")
#pragma GCC optimize("-fcse-skip-blocks")
#pragma GCC optimize("-fcse-follow-jumps")
#pragma GCC optimize("-fsched-interblock")
#pragma GCC optimize("-fpartial-inlining")
#pragma GCC optimize("no-stack-protector")
#pragma GCC optimize("-freorder-functions")
#pragma GCC optimize("-findirect-inlining")
#pragma GCC optimize("-fhoist-adjacent-loads")
#pragma GCC optimize("-frerun-cse-after-loop")
#pragma GCC optimize("inline-small-functions")
#pragma GCC optimize("-finline-small-functions")
#pragma GCC optimize("-ftree-switch-conversion")
#pragma GCC optimize("-foptimize-sibling-calls")
#pragma GCC optimize("-fexpensive-optimizations")
#pragma GCC optimize("-funsafe-loop-optimizations")
#pragma GCC optimize("inline-functions-called-once")
#pragma GCC optimize("-fdelete-null-pointer-checks")
#include<iostream>
#include<cmath>
#include<cstring>
#include<cstdio>
#include<algorithm>
#include<queue>
#include<vector>
#define ll long long
#define N 2000010
using namespace std;
const int INF=2147483647;
inline int read()
{
	int neg=1,num=0;char c=getchar();
	for(;!isdigit(c);c=getchar())if(c=='-')neg=-1;
	for(;isdigit(c);c=getchar())num=(num<<1)+(num<<3)+c-'0';
	return neg*num;
}
struct node
{
	int mi,mx;
}sum[N<<2];
int n,k,q[N],a[N],b[N],f[N][22][2];
inline node Push_up(node x,node y)
{
	node res;
	res.mi=min(x.mi,y.mi);
	res.mx=max(x.mx,y.mx);
	return res;
}
inline void Build(int x,int l,int r)
{
	if(l==r){sum[x].mx=a[l];sum[x].mi=b[l];return ;}
	int mid=l+r>>1;
	Build(x<<1,l,mid);Build(x<<1|1,mid+1,r);
	sum[x]=Push_up(sum[x<<1],sum[x<<1|1]);
}
inline void Query(int l,int r,int &x,int &y)
{
	int p=log2(r-l+1);
	x=max(f[l][p][0],f[r-(1<<p)+1][p][0]);
	y=min(f[l][p][1],f[r-(1<<p)+1][p][1]);
}
inline void Solve(int x)
{
	int l=x,r=n+1;
	int mi,mx;
	while(l+1<r)
	{
		int mid=(l+r)>>1;
		Query(x,mid,mx,mi);
		if(mx<=mi)l=mid;
		else r=mid;
	}
	Query(x,l,mx,mi);
	q[x]=min(mi,mx);
	if(l<n)q[x]=max(q[x],min(max(mx,a[l+1]),min(mi,b[l+1])));
}
int main()
{
	n=read();k=read();
	for(int i=1;i<=n;i++)a[i]=read()*100;
	for(int i=1;i<=n;i++)b[i]=read();
	for(int i=1;i<=n;i++)f[i][0][0]=a[i],f[i][0][1]=b[i];
	int len=(int)(log(n)/log(2));
	for(int i=1;i<=len;i++)
		 for(int j=1;j<=n-(1<<i)+1;j++)
	  		f[j][i][0]=max(f[j][i-1][0],f[j+(1<<(i-1))][i-1][0]),f[j][i][1]=min(f[j][i-1][1],f[j+(1<<i-1)][i-1][1]);
	for(int i=1;i<=n;i++)Solve(i);
	sort(q+1,q+n+1);
//	for(int i=1;i<=n;i++)printf("%d ",q[i]);
	double ans=(double)(0);
	double sum=1.0*k/(double)n;
	for(int i=1;i<=n-k+1;i++)
	{
		ans+=sum*q[i];
		sum*=(double)(n-k-i+1)/(double)(n-i);
	}
	printf("%.7lf",ans);
	return 0;
}


#include<iostream>
#include<cmath>
#include<cstring>
#include<cstdio>
#include<algorithm>
#include<queue>
#include<vector>
#define ll long long
#define N 2000010
using namespace std;
const int INF=2147483647;
inline int read()
{
	int neg=1,num=0;char c=getchar();
	for(;!isdigit(c);c=getchar())if(c=='-')neg=-1;
	for(;isdigit(c);c=getchar())num=(num<<1)+(num<<3)+c-'0';
	return neg*num;
}
struct node
{
	int mi,mx;
}sum[N<<2];
int n,k,q[N],a[N],b[N];
inline node Push_up(node x,node y)
{
	node res;
	res.mi=min(x.mi,y.mi);
	res.mx=max(x.mx,y.mx);
	return res;
}
inline void Build(int x,int l,int r)
{
	if(l==r){sum[x].mx=a[l];sum[x].mi=b[l];return ;}
	int mid=l+r>>1;
	Build(x<<1,l,mid);Build(x<<1|1,mid+1,r);
	sum[x]=Push_up(sum[x<<1],sum[x<<1|1]);
}
inline node Query(int x,int l,int r,int L,int R)
{
	if(l>=L && r<=R)return sum[x];
	int mid=l+r>>1,f1=0,f2=0;
	node a1,a2;
	if(L<=mid)f1=1,a1=Query(x<<1,l,mid,L,R);
	if(R>mid)f2=1,a2=Query(x<<1|1,mid+1,r,L,R);
	return (f1 && f2)?Push_up(a1,a2):(f1?a1:a2);
}
inline void Solve(int x)
{
	int l=x,r=n+1;node res;
	while(l+1<r)
	{
		int mid=(l+r)>>1;
		res=Query(1,1,n,x,mid);
		if(res.mx<=res.mi)l=mid;
		else r=mid;
	}
	res=Query(1,1,n,x,l);
	q[x]=min(res.mi,res.mx);
	if(l<n)q[x]=max(q[x],min(max(res.mx,a[l+1]),min(res.mi,b[l+1])));
}
int main()
{
	n=read();k=read();
	for(int i=1;i<=n;i++)a[i]=read()*100;
	for(int i=1;i<=n;i++)b[i]=read();
	Build(1,1,n);
	for(int i=1;i<=n;i++)Solve(i);
	sort(q+1,q+n+1);
//	for(int i=1;i<=n;i++)printf("%d ",q[i]);
	double ans=(double)(0);
	double sum=1.0*k/(double)n;
	for(int i=1;i<=n-k+1;i++)
	{
		ans+=sum*q[i];
		sum*=(double)(n-k-i+1)/(double)(n-i);
	}
	printf("%.7lf",ans);
	return 0;
}


#pragma GCC optimize(2)
#pragma GCC optimize(3,"Ofast","inline")
#pragma GCC optimize("Ofast")
#pragma GCC optimize("inline")
#pragma GCC optimize("-fgcse")
#pragma GCC optimize("-fgcse-lm")
#pragma GCC optimize("-fipa-sra")
#pragma GCC optimize("-ftree-pre")
#pragma GCC optimize("-ftree-vrp")
#pragma GCC optimize("-fpeephole2")
#pragma GCC optimize("-ffast-math")
#pragma GCC optimize("-fsched-spec")
#pragma GCC optimize("unroll-loops")
#pragma GCC optimize("-falign-jumps")
#pragma GCC optimize("-falign-loops")
#pragma GCC optimize("-falign-labels")
#pragma GCC optimize("-fdevirtualize")
#pragma GCC optimize("-fcaller-saves")
#pragma GCC optimize("-fcrossjumping")
#pragma GCC optimize("-fthread-jumps")
#pragma GCC optimize("-funroll-loops")
#pragma GCC optimize("-fwhole-program")
#pragma GCC optimize("-freorder-blocks")
#pragma GCC optimize("-fschedule-insns")
#pragma GCC optimize("inline-functions")
#pragma GCC optimize("-ftree-tail-merge")
#pragma GCC optimize("-fschedule-insns2")
#pragma GCC optimize("-fstrict-aliasing")
#pragma GCC optimize("-fstrict-overflow")
#pragma GCC optimize("-falign-functions")
#pragma GCC optimize("-fcse-skip-blocks")
#pragma GCC optimize("-fcse-follow-jumps")
#pragma GCC optimize("-fsched-interblock")
#pragma GCC optimize("-fpartial-inlining")
#pragma GCC optimize("no-stack-protector")
#pragma GCC optimize("-freorder-functions")
#pragma GCC optimize("-findirect-inlining")
#pragma GCC optimize("-fhoist-adjacent-loads")
#pragma GCC optimize("-frerun-cse-after-loop")
#pragma GCC optimize("inline-small-functions")
#pragma GCC optimize("-finline-small-functions")
#pragma GCC optimize("-ftree-switch-conversion")
#pragma GCC optimize("-foptimize-sibling-calls")
#pragma GCC optimize("-fexpensive-optimizations")
#pragma GCC optimize("-funsafe-loop-optimizations")
#pragma GCC optimize("inline-functions-called-once")
#pragma GCC optimize("-fdelete-null-pointer-checks")
#include<iostream>
#include<cmath>
#include<cstring>
#include<cstdio>
#include<algorithm>
#include<queue>
#include<vector>
#define ll long long
#define N 1000010
using namespace std;
const int INF=2147483647;
inline int read()
{
	int neg=1,num=0;char c=getchar();
	for(;!isdigit(c);c=getchar())if(c=='-')neg=-1;
	for(;isdigit(c);c=getchar())num=(num<<1)+(num<<3)+c-'0';
	return neg*num;
}
struct node
{
	int mi,mx;
}sum[N<<2];
int n,k,q[N],a[N],b[N],f[N][21][2];
inline node Push_up(node x,node y)
{
	node res;
	res.mi=min(x.mi,y.mi);
	res.mx=max(x.mx,y.mx);
	return res;
}
inline void Build(int x,int l,int r)
{
	if(l==r){sum[x].mx=a[l];sum[x].mi=b[l];return ;}
	int mid=l+r>>1;
	Build(x<<1,l,mid);Build(x<<1|1,mid+1,r);
	sum[x]=Push_up(sum[x<<1],sum[x<<1|1]);
}
inline void Query(int l,int r,int &x,int &y)
{
	int p=log2(r-l+1);
	x=max(f[l][p][0],f[r-(1<<p)+1][p][0]);
	y=min(f[l][p][1],f[r-(1<<p)+1][p][1]);
}
inline void Solve(int x)
{
	int l=x,r=n+1;
	int mi,mx;
	while(l+1<r)
	{
		int mid=(l+r)>>1;
		Query(x,mid,mx,mi);
		if(mx<=mi)l=mid;
		else r=mid;
	}
	Query(x,l,mx,mi);
	q[x]=min(mi,mx);
	if(l<n)q[x]=max(q[x],min(max(mx,a[l+1]),min(mi,b[l+1])));
}
int main()
{
	n=read();k=read();
	for(int i=1;i<=n;i++)a[i]=read()*100;
	for(int i=1;i<=n;i++)b[i]=read();
	for(int i=1;i<=n;i++)f[i][0][0]=a[i],f[i][0][1]=b[i];
	int len=(int)(log(n)/log(2));
	for(int i=1;i<=len;i++)
		 for(int j=1;j<=n-(1<<i)+1;j++)
	  		f[j][i][0]=max(f[j][i-1][0],f[j+(1<<(i-1))][i-1][0]),f[j][i][1]=min(f[j][i-1][1],f[j+(1<<i-1)][i-1][1]);
	for(int i=1;i<=n;i++)Solve(i);
	sort(q+1,q+n+1);
//	for(int i=1;i<=n;i++)printf("%d ",q[i]);
	double ans=(double)(0);
	double sum=1.0*k/(double)n;
	for(int i=1;i<=n-k+1;i++)
	{
		ans+=sum*q[i];
		sum*=(double)(n-k-i+1)/(double)(n-i);
	}
	printf("%.7lf",ans);
	return 0;
}


#include<iostream>
#include<cmath>
#include<cstring>
#include<cstdio>
#include<algorithm>
#include<queue>
#include<vector>
#define ll long long
#define N 200010
using namespace std;
const int INF=2147483647;
inline int read()
{
	int neg=1,num=0;char c=getchar();
	for(;!isdigit(c);c=getchar())if(c=='-')neg=-1;
	for(;isdigit(c);c=getchar())num=(num<<1)+(num<<3)+c-'0';
	return neg*num;
}
struct node
{
	int mi,mx;
}sum[N<<2];
int n,k,q[N],a[N],b[N];
inline node Push_up(node x,node y)
{
	node res;
	res.mi=min(x.mi,y.mi);
	res.mx=max(x.mx,y.mx);
	return res;
}
inline void Build(int x,int l,int r)
{
	if(l==r){sum[x].mx=a[l];sum[x].mi=b[l];return ;}
	int mid=l+r>>1;
	Build(x<<1,l,mid);Build(x<<1|1,mid+1,r);
	sum[x]=Push_up(sum[x<<1],sum[x<<1|1]);
}
inline node Query(int x,int l,int r,int L,int R)
{
	if(l>=L && r<=R)return sum[x];
	int mid=l+r>>1,f1=0,f2=0;
	node a1,a2;
	if(L<=mid)f1=1,a1=Query(x<<1,l,mid,L,R);
	if(R>mid)f2=1,a2=Query(x<<1|1,mid+1,r,L,R);
	return (f1 && f2)?Push_up(a1,a2):(f1?a1:a2);
}
inline void Solve(int x)
{
	int l=x,r=n+1;node res;
	while(l+1<r)
	{
		int mid=(l+r)>>1;
		res=Query(1,1,n,x,mid);
		if(res.mx<=res.mi)l=mid;
		else r=mid;
	}
	res=Query(1,1,n,x,l);
	q[x]=min(res.mi,res.mx);
	if(l<n)q[x]=max(q[x],min(max(res.mx,a[l+1]),min(res.mi,b[l+1])));
}
int main()
{
	n=read();k=read();
	for(int i=1;i<=n;i++)a[i]=read()*100;
	for(int i=1;i<=n;i++)b[i]=read();
	Build(1,1,n);
	for(int i=1;i<=n;i++)Solve(i);
	sort(q+1,q+n+1);
//	for(int i=1;i<=n;i++)printf("%d ",q[i]);
	double ans=(double)(0);
	double sum=1.0*k/(double)n;
	for(int i=1;i<=n-k+1;i++)
	{
		ans+=sum*q[i];
		sum*=(double)(n-k-i+1)/(double)(n-i);
	}
	printf("%.7lf",ans);
	return 0;
}


#pragma GCC optimize(2)
#pragma GCC optimize(3,"Ofast","inline")
#pragma GCC optimize("Ofast")
#pragma GCC optimize("inline")
#pragma GCC optimize("-fgcse")
#pragma GCC optimize("-fgcse-lm")
#pragma GCC optimize("-fipa-sra")
#pragma GCC optimize("-ftree-pre")
#pragma GCC optimize("-ftree-vrp")
#pragma GCC optimize("-fpeephole2")
#pragma GCC optimize("-ffast-math")
#pragma GCC optimize("-fsched-spec")
#pragma GCC optimize("unroll-loops")
#pragma GCC optimize("-falign-jumps")
#pragma GCC optimize("-falign-loops")
#pragma GCC optimize("-falign-labels")
#pragma GCC optimize("-fdevirtualize")
#pragma GCC optimize("-fcaller-saves")
#pragma GCC optimize("-fcrossjumping")
#pragma GCC optimize("-fthread-jumps")
#pragma GCC optimize("-funroll-loops")
#pragma GCC optimize("-fwhole-program")
#pragma GCC optimize("-freorder-blocks")
#pragma GCC optimize("-fschedule-insns")
#pragma GCC optimize("inline-functions")
#pragma GCC optimize("-ftree-tail-merge")
#pragma GCC optimize("-fschedule-insns2")
#pragma GCC optimize("-fstrict-aliasing")
#pragma GCC optimize("-fstrict-overflow")
#pragma GCC optimize("-falign-functions")
#pragma GCC optimize("-fcse-skip-blocks")
#pragma GCC optimize("-fcse-follow-jumps")
#pragma GCC optimize("-fsched-interblock")
#pragma GCC optimize("-fpartial-inlining")
#pragma GCC optimize("no-stack-protector")
#pragma GCC optimize("-freorder-functions")
#pragma GCC optimize("-findirect-inlining")
#pragma GCC optimize("-fhoist-adjacent-loads")
#pragma GCC optimize("-frerun-cse-after-loop")
#pragma GCC optimize("inline-small-functions")
#pragma GCC optimize("-finline-small-functions")
#pragma GCC optimize("-ftree-switch-conversion")
#pragma GCC optimize("-foptimize-sibling-calls")
#pragma GCC optimize("-fexpensive-optimizations")
#pragma GCC optimize("-funsafe-loop-optimizations")
#pragma GCC optimize("inline-functions-called-once")
#pragma GCC optimize("-fdelete-null-pointer-checks")
#include<iostream>
#include<cmath>
#include<cstring>
#include<cstdio>
#include<algorithm>
#include<queue>
#include<vector>
#define ll long long
#define N 2000010
using namespace std;
const int INF=2147483647;
inline int read()
{
	int neg=1,num=0;char c=getchar();
	for(;!isdigit(c);c=getchar())if(c=='-')neg=-1;
	for(;isdigit(c);c=getchar())num=(num<<1)+(num<<3)+c-'0';
	return neg*num;
}
struct node
{
	int mi,mx;
}sum[N<<2];
int n,k,q[N],a[N],b[N];
inline node Push_up(node x,node y)
{
	node res;
	res.mi=min(x.mi,y.mi);
	res.mx=max(x.mx,y.mx);
	return res;
}
inline void Build(int x,int l,int r)
{
	if(l==r){sum[x].mx=a[l];sum[x].mi=b[l];return ;}
	int mid=l+r>>1;
	Build(x<<1,l,mid);Build(x<<1|1,mid+1,r);
	sum[x]=Push_up(sum[x<<1],sum[x<<1|1]);
}
inline node Query(int x,int l,int r,int L,int R)
{
	if(l>=L && r<=R)return sum[x];
	int mid=l+r>>1,f1=0,f2=0;
	node a1,a2;
	if(L<=mid)f1=1,a1=Query(x<<1,l,mid,L,R);
	if(R>mid)f2=1,a2=Query(x<<1|1,mid+1,r,L,R);
	return (f1 && f2)?Push_up(a1,a2):(f1?a1:a2);
}
inline void Solve(int x)
{
	int l=x,r=n+1;node res;
	while(l+1<r)
	{
		int mid=(l+r)>>1;
		res=Query(1,1,n,x,mid);
		if(res.mx<=res.mi)l=mid;
		else r=mid;
	}
	res=Query(1,1,n,x,l);
	q[x]=min(res.mi,res.mx);
	if(l<n)q[x]=max(q[x],min(max(res.mx,a[l+1]),min(res.mi,b[l+1])));
}
int main()
{
	n=read();k=read();
	for(int i=1;i<=n;i++)a[i]=read()*100;
	for(int i=1;i<=n;i++)b[i]=read();
	Build(1,1,n);
	for(int i=1;i<=n;i++)Solve(i);
	sort(q+1,q+n+1);
//	for(int i=1;i<=n;i++)printf("%d ",q[i]);
	double ans=(double)(0);
	double sum=1.0*k/(double)n;
	for(int i=1;i<=n-k+1;i++)
	{
		ans+=sum*q[i];
		sum*=(double)(n-k-i+1)/(double)(n-i);
	}
	printf("%.7lf",ans);
	return 0;
}


#include<iostream>
#include<cmath>
#include<cstring>
#include<cstdio>
#include<algorithm>
#include<queue>
#include<vector>
#define ll long long
#define N 200010
using namespace std;
const int INF=2147483647;
inline int read()
{
	int neg=1,num=0;char c=getchar();
	for(;!isdigit(c);c=getchar())if(c=='-')neg=-1;
	for(;isdigit(c);c=getchar())num=(num<<1)+(num<<3)+c-'0';
	return neg*num;
}
struct node
{
	int mi,mx;
}sum[N<<2];
int n,k,q[N],a[N],b[N];
inline node Push_up(node x,node y)
{
	node res;
	res.mi=min(x.mi,y.mi);
	res.mx=max(x.mx,y.mx);
	return res;
}
inline void Build(int x,int l,int r)
{
	if(l==r){sum[x].mx=a[l];sum[x].mi=b[l];return ;}
	int mid=l+r>>1;
	Build(x<<1,l,mid);Build(x<<1|1,mid+1,r);
	sum[x]=Push_up(sum[x<<1],sum[x<<1|1]);
}
inline node Query(int x,int l,int r,int L,int R)
{
	if(l>=L && r<=R)return sum[x];
	int mid=l+r>>1,f1=0,f2=0;
	node a1,a2;
	if(L<=mid)f1=1,a1=Query(x<<1,l,mid,L,R);
	if(R>mid)f2=1,a2=Query(x<<1|1,mid+1,r,L,R);
	return (f1 && f2)?Push_up(a1,a2):(f1?a1:a2);
}
inline void Solve(int x)
{
	int l=x,r=n+1;node res;
	while(l+1<r)
	{
		int mid=(l+r)>>1;
		res=Query(1,1,n,x,mid);
		if(res.mx<=res.mi)l=mid;
		else r=mid;
	}
	res=Query(1,1,n,x,l);
	q[x]=min(res.mi,res.mx);
	if(l<n)q[x]=max(q[x],min(max(res.mx,a[l+1]),min(res.mi,b[l+1])));
}
int main()
{
	n=read();k=read();
	for(int i=1;i<=n;i++)a[i]=read()*100;
	for(int i=1;i<=n;i++)b[i]=read();
	Build(1,1,n);
	for(int i=1;i<=n;i++)Solve(i);
	sort(q+1,q+n+1);
//	for(int i=1;i<=n;i++)printf("%d ",q[i]);
	long double ans=(long double)(0);
	long double sum=1.0*k/(long double)n;
	for(int i=1;i<=n-k+1;i++)
	{
		ans+=sum*q[i];
		sum*=(long double)(n-k-i+1)/(long double)(n-i);
	}
	printf("%.7Lf",ans);
	return 0;
}


# include <bits/stdc++.h>
# define fi cin
# define ll long long
# define fo cout
# define x first
# define y second
# define IOS ios_base :: sync_with_stdio(0)
# define db long double
using namespace std;
int dp[1 << 20];
int a[1 << 20];
int b[1 << 20];
int lg[1 << 20];
db p[1 << 20];
int main(void)
{
    int n,k;
    IOS;
    fi>>n>>k;
    for (int i = 1;i <= n;++i) fi>>a[i];
    for (int i = 1;i <= n;++i)
    {
        fi>>b[i];
        dp[i] = min(100 * a[i],b[i]);
    }
    p[0] = 1;
    for (int i = 1;i <= n;++i) p[i] = p[i-1] / i;
    sort(dp+1,dp+1+n);
    db ans = 0;
    for (int i = 1;n - i - k + 1 >= 0;++i)
        ans += dp[i] * k * p[n] * p[n - i - k + 1] / (p[n - i] * p[n - k]);
    return fo << fixed << setprecision(8) << ans << '\n',0;
}


# include <bits/stdc++.h>
# define fi cin
# define ll long long
# define fo cout
# define x first
# define y second
# define IOS ios_base :: sync_with_stdio(0)
# define db long double
using namespace std;
int dp[1 << 20];
int a[20][1 << 20];
int b[20][1 << 20];
int lg[1 << 20];
int MIN(int l,int r)
{
    int k = lg[r - l + 1];
    return min(b[k][l],b[k][r - (1 << k) + 1]);
}
int MAX(int l,int r)
{
    int k = lg[r - l + 1];
    return max(a[k][l],a[k][r - (1 << k) + 1]);
}
int val(int l,int r)
{
    return min(100 * MAX(l,r),MIN(l,r));
}
int main(void)
{
    int n,k;
    IOS;
    fi>>n>>k;
    for (int i = 2;i <= n;++i) lg[i] = lg[i/2] + 1;
    for (int i = 1;i <= n;++i) fi>>a[0][i];
    for (int i = 1;i <= n;++i) fi>>b[0][i];
    for (int k = 1;k <= lg[n];++k)
        for (int i = 1;i + (1 << k) - 1 <= n;++i)
            a[k][i] = max(a[k-1][i],a[k-1][i + (1 << (k - 1))]),
            b[k][i] = min(b[k-1][i],b[k-1][i + (1 << (k - 1))]);
    for (int i = 1;i <= n;++i)
    {
        int p = i,u = n;
        while (u - p > 10)
        {
            int m1 = p + (u - p) / 3;
            int m2 = u - (u - p) / 3;
            if (val(i,m1) < val(i,m2))
                p = m1;
            else u = m2;
        }
        for (int j = p;j <= u;++j) dp[i] = max(dp[i],val(i,j));
    }
    sort(dp+1,dp+1+n);
    db ans = 0;
    double now = 1.0 * k / n;
    for (int i = 1;i <= n - k + 1;++i)
        ans += dp[i] * now,now /= n - i,now *= n - i - k + 1;
    return fo << fixed << setprecision(8) << ans << '\n',0;
}


# include <bits/stdc++.h>
# define fi cin
# define ll long long
# define fo cout
# define x first
# define y second
# define IOS ios_base :: sync_with_stdio(0)
# define db long double
using namespace std;
int dp[1 << 20];
int a[20][1 << 20];
int b[20][1 << 20];
int lg[1 << 20];
bool ch(int l,int r)
{
    int k = lg[r - l + 1];
    return max(a[k][l],a[k][r - (1 << k)]) > min(b[k][l],b[k][r - (1 << k)]);
}
int val(int l,int r)
{
    int k = lg[r - l + 1];
    return min(max(a[k][l],a[k][r - (1 << k)]),min(b[k][l],b[k][r - (1 << k)]));
}
int main(void)
{
    int n,k;
    IOS;
    fi>>n>>k;
    for (int i = 2;i <= 1e6+5;++i) lg[i] = lg[i/2] + 1;
    for (int i = 1;i <= n;++i) fi>>a[0][i];
    for (int i = 1;i <= n;++i) fi>>b[0][i],b[0][i] *= 100;
    for (int k = 1;k <= lg[n];++k)
        for (int i = 1;i + (1 << k) - 1 <= n;++i)
            a[k][i] = max(a[k-1][i],a[k-1][i + (1 << (k - 1))]),
            b[k][i] = min(b[k-1][i],b[k-1][i + (1 << (k - 1))]);
    for (int i = 1;i <= n;++i)
    {
        int p = i + 1,u = n;
        while (p + 1 < u)
        {
            int m = (p + u) / 2;
            if (ch(i,m)) p = m;
            else u = m - 1;
        }
        dp[i] = val(i,i);
        for (int j = max(p-5,i);j <= min(n,u+5);++j) dp[i] = max(dp[i],val(i,j));
    }
    sort(dp+1,dp+1+n);
    db ans = 0;
    double now = 1.0 * k / n;
    for (int i = 1;i <= n - k + 1;++i)
        ans += dp[i] * now,now /= n - i,now *= n - i - k + 1;
    return fo << fixed << setprecision(8) << ans << '\n',0;
}


# include <bits/stdc++.h>
# define fi cin
# define ll long long
# define fo cout
# define x first
# define y second
# define IOS ios_base :: sync_with_stdio(0)
# define db long double
using namespace std;
int dp[1 << 20];
int a[20][1 << 20];
int b[20][1 << 20];
int lg[1 << 20];
bool ch(int l,int r)
{
    int k = lg[r - l + 1];
    return max(a[k][l],a[k][r - (1 << k) + 1]) <= min(b[k][l],b[k][r - (1 << k) + 1]);
}
int val(int l,int r)
{
    int k = lg[r - l + 1];
    return min(max(a[k][l],a[k][r - (1 << k) + 1]),min(b[k][l],b[k][r - (1 << k) + 1]));
}
int main(void)
{
    int n,k;
    IOS;
    fi>>n>>k;
    for (int i = 2;i <= 1e6+5;++i) lg[i] = lg[i/2] + 1;
    for (int i = 1;i <= n;++i) fi>>a[0][i],a[0][i] *= 100;
    for (int i = 1;i <= n;++i) fi>>b[0][i];
    for (int k = 1;k <= lg[n];++k)
        for (int i = 1;i <= n;++i)
            {
                a[k][i] = a[k-1][i];
                b[k][i] = b[k-1][i];
                if (i + (1 << (k-1)) <= n)
                    a[k][i] = max(a[k][i],a[k-1][i + (1 << (k-1))]),
                    b[k][i] = min(b[k][i],b[k-1][i + (1 << (k-1))]);
            }
    for (int i = 1;i <= n;++i)
    {
        int p = i,u = n;
        while (p < u)
        {
            int m = (p + u + 1) / 2;
            if (ch(i,m)) p = m;
            else u = m - 1;
        }
        dp[i] = val(i,p);
        if (p < n) dp[i] = max(dp[i],val(i,p+1));
    }
    sort(dp+1,dp+1+n);
    db ans = 0;
    double now = 1.0 * k / n;
    for (int i = 1;i <= n - k + 1;++i)
        ans += dp[i] * now,now /= n - i,now *= n - i - k + 1;
    return fo << fixed << setprecision(8) << ans << '\n',0;
}


# include <bits/stdc++.h>
# define fi cin
# define ll long long
# define fo cout
# define x first
# define y second
# define IOS ios_base :: sync_with_stdio(0)
# define db long double
using namespace std;
int dp[1 << 20];
int a[20][1 << 20];
int b[20][1 << 20];
int lg[1 << 20];
bool ch(int l,int r)
{
    int k = lg[r - l + 1];
    return max(a[k][l],a[k][r - (1 << k)]) > min(b[k][l],b[k][r - (1 << k)]);
}
int val(int l,int r)
{
    int k = lg[r - l + 1];
    return min(max(a[k][l],a[k][r - (1 << k)]),min(b[k][l],b[k][r - (1 << k)]));
}
int main(void)
{
    int n,k;
    IOS;
    fi>>n>>k;
    for (int i = 2;i <= 1e6+5;++i) lg[i] = lg[i/2] + 1;
    for (int i = 1;i <= n;++i) fi>>a[0][i],a[0][i] *= 100;
    for (int i = 1;i <= n;++i) fi>>b[0][i];
    for (int k = 1;k <= lg[n];++k)
        for (int i = 1;i + (1 << k) - 1 <= n;++i)
            a[k][i] = max(a[k-1][i],a[k-1][i + (1 << (k - 1))]),
            b[k][i] = min(b[k-1][i],b[k-1][i + (1 << (k - 1))]);
    for (int i = 1;i <= n;++i)
    {
        int p = i + 1,u = n;
        while (p + 1 < u)
        {
            int m = (p + u) / 2;
            if (ch(i,m)) p = m;
            else u = m - 1;
        }
        dp[i] = val(i,i);
        for (int j = max(p-5,i);j <= min(n,u+5);++j) dp[i] = max(dp[i],val(i,j));
    }
    sort(dp+1,dp+1+n);
    db ans = 0;
    double now = 1.0 * k / n;
    for (int i = 1;i <= n - k + 1;++i)
        ans += dp[i] * now,now /= n - i,now *= n - i - k + 1;
    return fo << fixed << setprecision(8) << ans << '\n',0;
}


# include <bits/stdc++.h>
# define fi cin
# define ll long long
# define fo cout
# define x first
# define y second
# define IOS ios_base :: sync_with_stdio(0)
# define db long double
using namespace std;
int dp[1 << 20];
int a[20][1 << 20];
int b[20][1 << 20];
int lg[1 << 20];
db p[1 << 20];
db fact[1 << 20];
int MIN(int l,int r)
{
    int k = lg[r - l + 1];
    return min(b[k][l],b[k][r - (1 << k) + 1]);
}
int MAX(int l,int r)
{
    int k = lg[r - l + 1];
    return max(a[k][l],a[k][r - (1 << k) + 1]);
}
int val(int l,int r)
{
    return min(100 * MAX(l,r),MIN(l,r));
}
int main(void)
{
    int n,k;
    IOS;
    fi>>n>>k;
    for (int i = 2;i <= n;++i) lg[i] = lg[i/2] + 1;
    for (int i = 1;i <= n;++i) fi>>a[0][i];
    for (int i = 1;i <= n;++i) fi>>b[0][i];
    for (int k = 1;k <= lg[n];++k)
        for (int i = 1;i + (1 << k) - 1 <= n;++i)
            a[k][i] = max(a[k-1][i],a[k-1][i + (1 << (k - 1))]),
            b[k][i] = min(b[k-1][i],b[k-1][i + (1 << (k - 1))]);
    for (int i = 1;i <= n;++i)
    {
        int p = i,u = n;
        while (u - p > 10)
        {
            int m1 = p + (u - p) / 3;
            int m2 = u - (u - p) / 3;
            if (val(i,m1) < val(i,m2))
                p = m1;
            else u = m2;
        }
        for (int j = p;j <= u;++j) dp[i] = max(dp[i],val(i,j));
    }
    fact[n+1] = 1;
    p[0] = 1;
    for (int i = 1;i <= n;++i) p[i] = p[i-1] / i;
    fact[n] = 1.0 / n;
    for (int i = n - 1;i;--i) fact[i] = fact[i+1] / i;
    fact[0] = fact[1];
    sort(dp+1,dp+1+n);
    db ans = 0;
    for (int i = 1;n - i - k + 1 >= 0;++i)
        ans += dp[i] * k * fact[n - i + 1] * p[n - i - k + 1] / p[n - k];
    return fo << fixed << setprecision(8) << ans << '\n',0;
}


# include <bits/stdc++.h>
# define fi cin
# define ll long long
# define fo cout
# define x first
# define y second
# define IOS ios_base :: sync_with_stdio(0)
# define db long double
using namespace std;
int dp[1 << 20];
int a[20][1 << 20];
int b[20][1 << 20];
int lg[1 << 20];
db p[1 << 20];
int MIN(int l,int r)
{
    int k = lg[r - l + 1];
    return min(b[k][l],b[k][r - (1 << k) + 1]);
}
int MAX(int l,int r)
{
    int k = lg[r - l + 1];
    return max(a[k][l],a[k][r - (1 << k) + 1]);
}
int val(int l,int r)
{
    return min(100 * MAX(l,r),MIN(l,r));
}
int main(void)
{
    int n,k;
    IOS;
    fi>>n>>k;
    for (int i = 2;i <= n;++i) lg[i] = lg[i/2] + 1;
    for (int i = 1;i <= n;++i) fi>>a[0][i];
    for (int i = 1;i <= n;++i) fi>>b[0][i];
    for (int k = 1;k < 20;++k)
        for (int i = 1;i <= n;++i)
            a[k][i] = max(a[k-1][i],a[k-1][i + (1 << (k - 1))]),
            b[k][i] = min(b[k-1][i],b[k-1][i + (1 << (k - 1))]);
    for (int i = 1;i <= n;++i)
    {
        int p = i,u = n;
        while (u - p >= 10)
        {
            int m = (p + u) / 2;
            if (val(i,m) <= val(i,m+1)) p = m;
            else u = m;
        }
        for (int j = p;j <= u;++j)
            dp[i] = max(dp[i],val(i,j));
    }
    p[0] = 1;
    for (int i = 1;i <= n;++i) p[i] = p[i-1] / i;
    sort(dp+1,dp+1+n);
    db ans = 0;
    for (int i = 1;n - i - k + 1 >= 0;++i)
        ans += dp[i] * k * p[n] * p[n - i - k + 1] / (p[n - i] * p[n - k]);
    return fo << fixed << setprecision(8) << ans << '\n',0;
}


# include <bits/stdc++.h>
# define fi cin
# define ll long long
# define fo cout
# define x first
# define y second
# define IOS ios_base :: sync_with_stdio(0)
# define db long double
using namespace std;
int dp[1 << 20];
int a[20][1 << 20];
int b[20][1 << 20];
int lg[1 << 20];
db p[1 << 20];
int MIN(int l,int r)
{
    int k = lg[r - l + 1];
    return min(b[k][l],b[k][r - (1 << k) + 1]);
}
int MAX(int l,int r)
{
    int k = lg[r - l + 1];
    return max(a[k][l],a[k][r - (1 << k) + 1]);
}
int val(int l,int r)
{
    return min(100 * MAX(l,r),MIN(l,r));
}
int main(void)
{
    int n,k;
    IOS;
    fi>>n>>k;
    for (int i = 2;i <= n;++i) lg[i] = lg[i/2] + 1;
    for (int i = 1;i <= n;++i) fi>>a[0][i];
    for (int i = 1;i <= n;++i) fi>>b[0][i];
    for (int k = 1;k <= lg[n];++k)
        for (int i = 1;i + (1 << k) - 1 <= n;++i)
            a[k][i] = max(a[k-1][i],a[k-1][i + (1 << (k - 1))]),
            b[k][i] = min(b[k-1][i],b[k-1][i + (1 << (k - 1))]);
    for (int i = 1;i <= n;++i)
    {
        int p = i,u = n;
        while (u - p > 10)
        {
            int m1 = p + (u - p) / 3;
            int m2 = u - (u - p) / 3;
            if (val(i,m1) < val(i,m2))
                p = m1;
            else u = m2;
        }
        for (int j = p;j <= u;++j) dp[i] = max(dp[i],val(i,j));
    }
    p[0] = 1;
    for (int i = 1;i <= n;++i) p[i] = p[i-1] / i;
    sort(dp+1,dp+1+n);
    db ans = 0;
    for (int i = 1;n - i - k + 1 >= 0;++i)
        ans += dp[i] * k * p[n] * p[n - i - k + 1] / (p[n - i] * p[n - k]);
    return fo << fixed << setprecision(8) << ans << '\n',0;
}


# include <bits/stdc++.h>
# define fi cin
# define ll long long
# define fo cout
# define x first
# define y second
# define IOS ios_base :: sync_with_stdio(0)
# define db long double
using namespace std;
int dp[1 << 20];
int a[20][1 << 20];
int b[20][1 << 20];
int lg[1 << 20];
bool ch(int l,int r)
{
    int k = lg[r - l + 1];
    return max(a[k][l],a[k][r - (1 << k) + 1]) > min(b[k][l],b[k][r - (1 << k) + 1]);
}
int val(int l,int r)
{
    int k = lg[r - l + 1];
    return min(max(a[k][l],a[k][r - (1 << k) + 1]),min(b[k][l],b[k][r - (1 << k) + 1]));
}
int main(void)
{
    int n,k;
    IOS;
    fi>>n>>k;
    for (int i = 2;i <= 1e6+5;++i) lg[i] = lg[i/2] + 1;
    for (int i = 1;i <= n;++i) fi>>a[0][i],a[0][i] *= 100;
    for (int i = 1;i <= n;++i) fi>>b[0][i];
    for (int k = 1;k <= lg[n];++k)
        for (int i = 1;i + (1 << k) - 1 <= n;++i)
            a[k][i] = max(a[k-1][i],a[k-1][i + (1 << (k - 1))]),
            b[k][i] = min(b[k-1][i],b[k-1][i + (1 << (k - 1))]);
    for (int i = 1;i <= n;++i)
    {
        int p = i + 1,u = n;
        while (p + 1 < u)
        {
            int m = (p + u) / 2;
            if (ch(i,m)) p = m;
            else u = m - 1;
        }
        dp[i] = val(i,i);
        for (int j = max(p-5,i);j <= min(n,u+5);++j) dp[i] = max(dp[i],val(i,j));
    }
    sort(dp+1,dp+1+n);
    db ans = 0;
    double now = 1.0 * k / n;
    for (int i = 1;i <= n - k + 1;++i)
        ans += dp[i] * now,now /= n - i,now *= n - i - k + 1;
    return fo << fixed << setprecision(8) << ans << '\n',0;
}


# include <bits/stdc++.h>
# define fi cin
# define ll long long
# define fo cout
# define x first
# define y second
# define IOS ios_base :: sync_with_stdio(0)
# define db long double
using namespace std;
int dp[1 << 20];
int a[20][1 << 20];
int b[20][1 << 20];
int lg[1 << 20];
bool ch(int l,int r)
{
    int k = lg[r - l + 1];
    return max(a[k][l],a[k][r - (1 << k) + 1]) <= min(b[k][l],b[k][r - (1 << k) + 1]);
}
int val(int l,int r)
{
    int k = lg[r - l + 1];
    return min(max(a[k][l],a[k][r - (1 << k) + 1]),min(b[k][l],b[k][r - (1 << k) + 1]));
}
int main(void)
{
    int n,k;
    IOS;
    fi>>n>>k;
    for (int i = 2;i <= 1e6+5;++i) lg[i] = lg[i/2] + 1;
    for (int i = 1;i <= n;++i) fi>>a[0][i],a[0][i] *= 100;
    for (int i = 1;i <= n;++i) fi>>b[0][i];
    for (int k = 1;k <= lg[n];++k)
        for (int i = 1;i <= n;++i)
            {
                a[k][i] = a[k-1][i];
                b[k][i] = b[k-1][i];
                if (i + (1 << (k-1)) <= n)
                    a[k][i] = max(a[k][i],a[k-1][i + (1 << (k-1))]),
                    b[k][i] = min(b[k][i],b[k-1][i + (1 << (k-1))]);
            }
    for (int i = 1;i <= n;++i)
    {
        int p = i + 1,u = n;
        while (p < u)
        {
            int m = (p + u + 1) / 2;
            if (ch(i,m)) p = m;
            else u = m - 1;
        }
        dp[i] = val(i,p);
        if (p < n) dp[i] = max(dp[i],val(i,p+1));
    }
    sort(dp+1,dp+1+n);
    db ans = 0;
    double now = 1.0 * k / n;
    for (int i = 1;i <= n - k + 1;++i)
        ans += dp[i] * now,now /= n - i,now *= n - i - k + 1;
    return fo << fixed << setprecision(8) << ans << '\n',0;
}


# include <bits/stdc++.h>
# define fi cin
# define ll long long
# define fo cout
# define x first
# define y second
# define IOS ios_base :: sync_with_stdio(0)
# define db long double
using namespace std;
int dp[1 << 20];
int a[1 << 20];
int b[1 << 20];
int lg[1 << 20];
db p[1 << 20];
int main(void)
{
    int n,k;
    IOS;
    fi>>n>>k;
    for (int i = 1;i <= n;++i) fi>>a[i];
    for (int i = 1;i <= n;++i)
    {
        fi>>b[i];
        dp[i] = min(100 * a[i],b[i]);
    }
    p[0] = 1;
    for (int i = 1;i <= n;++i) p[i] = p[i-1] / i;
    sort(dp+1,dp+1+n);
    db ans = 0;
    for (int i = 1;n - i - k + 1 >= 0;++i)
        ans += dp[i] * k * p[n] * p[n - i - k + 1] / (p[n - i] * p[n - k]);
    return fo << ans << '\n',0;
}


# include <bits/stdc++.h>
# define fi cin
# define ll long long
# define fo cout
# define x first
# define y second
# define IOS ios_base :: sync_with_stdio(0)
# define db long double
using namespace std;
int dp[1 << 20];
int a[20][1 << 20];
int b[20][1 << 20];
int lg[1 << 20];
int MIN(int l,int r)
{
    int k = lg[r - l + 1];
    return min(b[k][l],b[k][r - (1 << k) + 1]);
}
int MAX(int l,int r)
{
    int k = lg[r - l + 1];
    return max(a[k][l],a[k][r - (1 << k) + 1]);
}
bool ch(int l,int r)
{
    int k = lg[r - l + 1];
    return MAX(l,r) * 100 > MIN(l,r);
}
int val(int l,int r)
{
    return min(100 * MAX(l,r),MIN(l,r));
}
int main(void)
{
    int n,k;
    IOS;
    fi>>n>>k;
    for (int i = 2;i <= 1e6;++i) lg[i] = lg[i/2] + 1;
    for (int i = 1;i <= n;++i) fi>>a[0][i];
    for (int i = 1;i <= n;++i) fi>>b[0][i];
    for (int k = 1;k <= lg[n];++k)
        for (int i = 1;i + (1 << k) - 1 <= n;++i)
            a[k][i] = max(a[k-1][i],a[k-1][i + (1 << (k - 1))]),
            b[k][i] = min(b[k-1][i],b[k-1][i + (1 << (k - 1))]);
    for (int i = 1;i <= n;++i)
    {
        int p = i + 1,u = n;
        while (p + 1 < u)
        {
            int m = (p + u) / 2;
            if (ch(i,m)) p = m;
            else u = m - 1;
        }
        dp[i] = val(i,i);
        for (int j = p;j <= u;++j) dp[i] = max(dp[i],val(i,j));
    }
    sort(dp+1,dp+1+n);
    db ans = 0;
    double now = 1.0 * k / n;
    for (int i = 1;i <= n - k + 1;++i)
        ans += dp[i] * now,now /= n - i,now *= n - i - k + 1;
    return fo << fixed << setprecision(8) << ans << '\n',0;
}


# include <bits/stdc++.h>
# define fi cin
# define ll long long
# define fo cout
# define x first
# define y second
# define IOS ios_base :: sync_with_stdio(0)
# define db long double
using namespace std;
int dp[1 << 20];
int a[20][1 << 20];
int b[20][1 << 20];
int lg[1 << 20];
db p[1 << 20];
int MIN(int l,int r)
{
    int k = lg[r - l + 1];
    return min(b[k][l],b[k][r - (1 << k) + 1]);
}
int MAX(int l,int r)
{
    int k = lg[r - l + 1];
    return max(a[k][l],a[k][r - (1 << k) + 1]);
}
int val(int l,int r)
{
    return min(100 * MAX(l,r),MIN(l,r));
}
int main(void)
{
    int n,k;
    IOS;
    fi>>n>>k;
    for (int i = 2;i <= n;++i) lg[i] = lg[i/2] + 1;
    for (int i = 1;i <= n;++i) fi>>a[0][i];
    for (int i = 1;i <= n;++i) fi>>b[0][i];
    for (int k = 1;k <= lg[n];++k)
        for (int i = 1;i + (1 << k) - 1 <= n;++i)
            a[k][i] = max(a[k-1][i],a[k-1][i + (1 << (k - 1))]),
            b[k][i] = min(b[k-1][i],b[k-1][i + (1 << (k - 1))]);
    for (int i = 1;i <= n;++i)
    {
        int p = i,u = n;
        while (u - p >= 10)
        {
            int m = (p + u) / 2;
            if (val(i,m) >= val(i,m-1)) p = m;
            else u = m;
        }
        for (int j = p;j <= u;++j)
            dp[i] = max(dp[i],val(i,j));
    }
    p[0] = 1;
    for (int i = 1;i <= n;++i) p[i] = p[i-1] / i;
    sort(dp+1,dp+1+n);
    db ans = 0;
    for (int i = 1;n - i - k + 1 >= 0;++i)
        ans += dp[i] * k * p[n] * p[n - i - k + 1] / (p[n - i] * p[n - k]);
    return fo << fixed << setprecision(8) << ans << '\n',0;
}


# include <bits/stdc++.h>
# define fi cin
# define ll long long
# define fo cout
# define x first
# define y second
# define IOS ios_base :: sync_with_stdio(0)
# define db long double
using namespace std;
int dp[1 << 20];
int a[20][1 << 20];
int b[20][1 << 20];
int lg[1 << 20];
db p[1 << 20];
db fact[1 << 20];
int MIN(int l,int r)
{
    int k = lg[r - l + 1];
    return min(b[k][l],b[k][r - (1 << k) + 1]);
}
int MAX(int l,int r)
{
    int k = lg[r - l + 1];
    return max(a[k][l],a[k][r - (1 << k) + 1]);
}
int val(int l,int r)
{
    return min(100 * MAX(l,r),MIN(l,r));
}
int main(void)
{
    int n,k;
    IOS;
    fi>>n>>k;
    for (int i = 2;i <= n;++i) lg[i] = lg[i/2] + 1;
    for (int i = 1;i <= n;++i) fi>>a[0][i];
    for (int i = 1;i <= n;++i) fi>>b[0][i];
    for (int k = 1;k <= lg[n];++k)
        for (int i = 1;i + (1 << k) - 1 <= n;++i)
            a[k][i] = max(a[k-1][i],a[k-1][i + (1 << (k - 1))]),
            b[k][i] = min(b[k-1][i],b[k-1][i + (1 << (k - 1))]);
    for (int i = 1;i <= n;++i)
    {
        int p = i,u = n;
        while (u - p > 10)
        {
            int m1 = p + (u - p) / 3;
            int m2 = u - (u - p) / 3;
            if (val(i,m1) < val(i,m2))
                p = m1;
            else u = m2;
        }
        for (int j = p;j <= u;++j) dp[i] = max(dp[i],val(i,j));
    }
    fact[n+1] = 1;
    p[0] = 1;
    for (int i = 1;i <= n;++i) p[i] = p[i-1] / i;
    fact[n] = 1.0 / n;
    for (int i = n - 1;i;--i) fact[i] = fact[i+1] / i;
    fact[0] = fact[1];
    sort(dp+1,dp+1+n);
    db ans = 0;
    for (int i = 1;n - i - k + 1 >= 0;++i)
        ans += dp[i] * k * fact[n - i + 1] * p[n - i - k + 1];
    for (int i = 1;i <= n - k;++i) ans *= i;
    return fo << fixed << setprecision(8) << ans << '\n',0;
}


# include <bits/stdc++.h>
# define fi cin
# define ll long long
# define fo cout
# define x first
# define y second
# define IOS ios_base :: sync_with_stdio(0)
# define db long double
using namespace std;
int dp[1 << 20];
int a[20][1 << 20];
int b[20][1 << 20];
int lg[1 << 20];
bool ch(int l,int r)
{
    int k = lg[r - l + 1];
    return max(a[k][l],a[k][r - (1 << k) + 1]) <= min(b[k][l],b[k][r - (1 << k) + 1]);
}
int val(int l,int r)
{
    int k = lg[r - l + 1];
    return min(max(a[k][l],a[k][r - (1 << k) + 1]),min(b[k][l],b[k][r - (1 << k) + 1]));
}
int main(void)
{
    int n,k;
    IOS;
    fi>>n>>k;
    for (int i = 2;i <= 1e6+5;++i) lg[i] = lg[i/2] + 1;
    for (int i = 1;i <= n;++i) fi>>a[0][i],a[0][i] *= 100;
    for (int i = 1;i <= n;++i) fi>>b[0][i];
    for (int k = 1;k <= lg[n];++k)
        for (int i = 1;i <= n;++i)
            {
                a[k][i] = a[k-1][i];
                b[k][i] = b[k-1][i];
                if (i + (1 << (k-1)) <= n)
                    a[k][i] = max(a[k][i],a[k-1][i + (1 << (k-1))]),
                    b[k][i] = min(b[k][i],b[k-1][i + (1 << (k-1))]);
            }
    for (int i = 1;i <= n;++i)
    {
        int p = i + 1,u = n;
        while (p + 1 < u)
        {
            int m = (p + u + 1) / 2;
            if (ch(i,m)) p = m;
            else u = m - 1;
        }
        dp[i] = val(i,p);
        if (p < n) dp[i] = max(dp[i],val(i,p+1));
    }
    sort(dp+1,dp+1+n);
    db ans = 0;
    double now = 1.0 * k / n;
    for (int i = 1;i <= n - k + 1;++i)
        ans += dp[i] * now,now /= n - i,now *= n - i - k + 1;
    return fo << fixed << setprecision(8) << ans << '\n',0;
}


# include <bits/stdc++.h>
# define fi cin
# define ll long long
# define fo cout
# define x first
# define y second
# define IOS ios_base :: sync_with_stdio(0)
# define db long double
using namespace std;
int dp[1 << 20];
int a[20][1 << 20];
int b[20][1 << 20];
int lg[1 << 20];
db p[1 << 20];
db fact[1 << 20];
int MIN(int l,int r)
{
    int k = lg[r - l + 1];
    return min(b[k][l],b[k][r - (1 << k) + 1]);
}
int MAX(int l,int r)
{
    int k = lg[r - l + 1];
    return max(a[k][l],a[k][r - (1 << k) + 1]);
}
int val(int l,int r)
{
    return min(100 * MAX(l,r),MIN(l,r));
}
int main(void)
{
    int n,k;
    IOS;
    fi>>n>>k;
    for (int i = 2;i <= n;++i) lg[i] = lg[i/2] + 1;
    for (int i = 1;i <= n;++i) fi>>a[0][i];
    for (int i = 1;i <= n;++i) fi>>b[0][i];
    for (int k = 1;k <= lg[n];++k)
        for (int i = 1;i + (1 << k) - 1 <= n;++i)
            a[k][i] = max(a[k-1][i],a[k-1][i + (1 << (k - 1))]),
            b[k][i] = min(b[k-1][i],b[k-1][i + (1 << (k - 1))]);
    for (int i = 1;i <= n;++i)
    {
        int p = i,u = n;
        while (u - p > 10)
        {
            int m1 = p + (u - p) / 3;
            int m2 = u - (u - p) / 3;
            if (val(i,m1) < val(i,m2))
                p = m1;
            else u = m2;
        }
        for (int j = p;j <= u;++j) dp[i] = max(dp[i],val(i,j));
    }
    fact[n+1] = 1;
    p[0] = 1;
    for (int i = 1;i <= n;++i) p[i] = p[i-1] / i;
    fact[n] = 1.0 / n;
    for (int i = n - 1;i;--i) fact[i] = fact[i+1] / i;
    fact[0] = fact[1];
    sort(dp+1,dp+1+n);
    db ans = 0;
    for (int i = 1;n - i - k + 1 >= 0 && i <= 100 && i <= n;++i)
        {
            db cnt = 1;
            for (int j = 1;j <= n;++j)
            {
                if (j <= n - i - k + 1) cnt /= j;
                if (j <= n - k) cnt *= j;
                if (n - j + 1 >= n - i + 1) cnt /= n - j + 1;
                ans += dp[i] * cnt;
            }
        }
    return fo << fixed << setprecision(8) << ans << '\n',0;
}


#include <bits/stdc++.h>

using namespace std;

int v[1000010];
int c[1000010];

#define MAX_N 1000010                           // adjust this value as needed
#define LOG_TWO_N 20                           // 2^10 > 1000, adjust this value as needed
#define EPS 1e-20
struct RMQ {                                          // Range Minimum Query
  int SpT[MAX_N][LOG_TWO_N];
  RMQ(){};
  void build(int n, int *A) {
    for (int i = 0; i < n; i++) SpT[i][0] = A[i]; // RMQ of sub array starting at index i + length 2^0=1
    for (int j = 1; (1<<j) <= n; j++)
      for (int i = 0; i + (1<<j) - 1 < n; i++)
        SpT[i][j] = min(SpT[i][j-1], SpT[i+(1<<(j-1))][j-1]);
  }
  int query(int i, int j) {
    int k = (int)floor(log((double)j-i+1) / log(2.0));    // 2^k <= (j-i+1)
    return min(SpT[i][k], SpT[j-(1<<k)+1][k]);
}
};
RMQ q1,q2;
double fat[1000010];

int main() {
	int n,k;
	fat[0] =1.0;
	for(int i = 1;i<=1000009;i++)
		fat[i] = fat[i-1] + (log2(i));

	scanf("%d %d",&n,&k);

	for(int i = 0;i<n;i++){
		scanf("%d",&v[i]);
		v[i]*=-100LL;
	}
	for(int j = 0;j<n;j++)
		scanf("%d",&c[j]);
	q1.build(n,v);
	q2.build(n,c);

	vector<int> show;
	for(int i = 0;i<n;i++){
		int lo = i,hi = n-1;
		while(lo<hi){
			int mid = (lo+hi+1)/2;
			pair<int,int> xd = make_pair(-q1.query(i,mid),q2.query(i,mid));//query(1,0,n-1,i,mid);
			if(xd.first<=xd.second)
				lo = mid;
			else
				hi = mid-1;
		}

		pair<int,int> ae =  make_pair(-q1.query(i,lo),q2.query(i,lo));//query(1,0,n-1,i,lo);
		pair<int,int> ae2;
		if(lo+1==n)ae2 = ae;
		else ae2 = make_pair(-q1.query(i,lo+1),q2.query(i,lo+1));

		if(min(ae.first,ae.second)>min(ae2.first,ae2.second))
			show.push_back(min(ae.first,ae.second));
		else
			show.push_back(min(ae2.first,ae2.second));
	}
	double ans = 0.0;
	sort(show.begin(),show.end());
	double aux = log2(k);
	for(int i = 0;i<=n-k;i++){
		double xd = pow(2,fat[n-i-1]+fat[n-k]+aux-fat[n-i-k]-fat[n]);
		if(xd<EPS)
			break;
		ans+=show[i]*xd;
	}

	printf("%.10lf\n",((double) ans));
	return 0;
}