#include <bits/stdc++.h>
using namespace std;
const int NMAX = 1e5 + 7;
long long n, a[NMAX], b[NMAX];
long long dp[NMAX];
struct linija {
  long long a, b;
};
linija c[NMAX];
int sz, cur;
double prijesek_x(int i, int j) {
  return (double)(c[i].b - c[j].b) / (c[j].a - c[i].a);
}
void dodaj(linija L) {
  c[sz].a = L.a;
  c[sz].b = L.b;
  while (sz >= 2 && prijesek_x(sz, sz - 1) <= prijesek_x(sz - 1, sz - 2)) {
    c[sz - 1].a = c[sz].a;
    c[sz - 1].b = c[sz].b;
    sz--;
  }
  sz++;
}
long long dobij(int ide) {
  while (cur + 1 < sz && (double)ide > prijesek_x(cur, cur + 1)) cur++;
  return 1LL * c[cur].a * ide + 1LL * c[cur].b;
}
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]);
  linija L = {b[1], 0};
  dodaj(L);
  for (int i = 2; i <= n; i++) {
    dp[i] = dobij(a[i]);
    linija L = {b[i], dp[i]};
    dodaj(L);
  }
  printf("%I64d\n", dp[n]);
  return 0;
}
