#include <bits/stdc++.h>
using namespace std;
struct pll {
  long long a, b;
  pll(long long a = 0, long long b = 0) : a(a), b(b) {}
  bool operator<=(int i) { return a <= b * i; }
  bool operator>(pll p2) { return a > p2.a || (a == p2.a && b >= p2.b); }
  bool before(pll f2, pll pos) {
    return pos.a * ((double)f2.a - a) > pos.b * ((double)b - f2.b);
  }
  pll inter(pll p) { return pll(b - p.b, p.a - a); }
} hull[100009], beg[100009];
int n, a[100009], b[100009], pos, h;
long long pd[100009];
void add(pll p) {
  if (h && p > hull[h - 1]) return;
  while (h > 1 && p.before(hull[h - 2], beg[h - 1])) h--;
  beg[h] = p.inter(hull[h - 1]);
  hull[h++] = p;
}
void process() {
  h = pos = pd[0] = 0;
  beg[h] = pll(-0x3f3f3f3f, 1);
  hull[h++] = pll(b[0], pd[0]);
  for (int i = 1; i < n; i++) {
    while (pos < h - 1 && beg[pos + 1] <= a[i]) pos++;
    pd[i] = (long long)hull[pos].a * a[i] + hull[pos].b;
    add(pll(b[i], pd[i]));
  }
}
int main() {
  while (scanf("%d", &n) == 1) {
    for (int x = 0; x < n; x++) scanf("%d", &a[x]);
    for (int x = 0; x < n; x++) scanf("%d", &b[x]);
    process();
    cout << pd[n - 1] << endl;
  }
  return 0;
}
