/*
#include <iostream>
#include <stdio.h>
using namespace std;
long long nums[52][52];
int main()
{
int n;
scanf("%d",&n);
int i,j;
nums[0][0] = 1;
for(i = 1;i <= n;i++){
for(j = 1;j <= i;j++)
{
nums[i][j] = nums[i-1][j] + nums[i-1][j-1];
printf("%lld ",nums[i][j]);
}
puts("");
}
}
*/
#include <iostream>
#include <stdio.h>
using namespace std;
int a[100100];
int b[100100];
int size;
int stack[100100];
int main()
{
int n;
int i;
scanf("%d",&n);
for(i = 0;i < n;i++)
{
scanf("%d",&a[i]);
}
for(j = 0;j < n;j++)
{
scanf("%d",&b[i]);
}
stack[0] = 0;
size = 1;
for(i = 1;i < n-1;i++)
{
if(b[stack[size-1]]*a[n-1] >
a[i] * b[stack[size-1]]+b[i]*a[n-1])
{
while(true)
{
if(size==1)
{
break;
}
if(a[i] * b[stack[size-1]]+b[i]*a[n-1] >
a[i] * b[stack[size-2]]+b[i]*a[n-1])
{
size--;
}
else
{
break;
}
}
stack[size] = i;
size++;
}
}
}



