#include <bits/stdc++.h>
using namespace std;
const double EPS = -1e8;
const double Pi = acos(-1);
bool inline equ(double a, double b) { return fabs(a - b) < EPS; }
int n;
long long a[100010], b[100010], dp[100010];
int dq[100010 * 2];
void inline solve() {
  dp[1] = 0ll;
  int *ds = dq, *de = dq;
  *de++ = 1;
  for (int i = 2; i <= n; i++) {
    while (de - ds > 1 &&
           dp[*ds] + b[*ds] * a[i] >= dp[ds[1]] + b[ds[1]] * a[i])
      ds++;
    dp[i] = dp[*ds] + b[*ds] * a[i];
    while (de - ds > 1 &&
           (dp[de[-1]] - dp[i]) / (0. + b[i] - b[de[-1]]) <=
               (dp[de[-2]] - dp[de[-1]]) / (0. + b[de[-1]] - b[de[-2]]))
      de--;
    *de++ = i;
  }
  printf("%I64d\n", dp[n]);
}
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) scanf("%I64d", &a[i]);
  for (int i = 1; i <= n; i++) scanf("%I64d", &b[i]);
  solve();
}
