#include <bits/stdc++.h>
using namespace std;
long long ara[100005], b[100005];
vector<long long> m, bb;
bool bad(int f1, int f2, int f3) {
  return (1.0 * (bb[f3] - bb[f1]) * (m[f1] - m[f2]) <=
          1.0 * (bb[f2] - bb[f1]) * (m[f1] - m[f3]));
}
void add(long long _m, long long _b) {
  m.push_back(_m);
  bb.push_back(_b);
  int sz = m.size();
  while (sz >= 3 && bad(sz - 3, sz - 2, sz - 1)) {
    long long t = m.back();
    m.pop_back();
    m.pop_back();
    m.push_back(t);
    t = bb.back();
    bb.pop_back();
    bb.pop_back();
    bb.push_back(t);
    sz--;
  }
  return;
}
long long eval(int i, long long x) { return m[i] * x + bb[i]; }
long long query(long long x) {
  int lo = 0, hi = m.size() - 1;
  long long mn = LLONG_MAX;
  while (lo + 5 < hi) {
    int m1 = (lo + hi) / 2;
    int m2 = m1 + 1;
    long long y1 = eval(m1, x);
    long long y2 = eval(m2, x);
    if (y1 <= y2)
      mn = y1, hi = m1;
    else
      mn = y2, lo = m2;
  }
  for (int i = lo; i <= hi; i++) mn = min(mn, eval(i, x));
  return mn;
}
int main() {
  int n;
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) scanf("%lld", &ara[i]);
  for (int i = 1; i <= n; i++) scanf("%lld", &b[i]);
  if (n == 1) {
    puts("0");
    return 0;
  }
  long long res = LLONG_MAX;
  add(b[1], 0);
  for (int i = 2; i <= n; i++) {
    res = query(ara[i]);
    add(b[i], res);
  }
  printf("%lld\n", res);
  return 0;
}
