#include <bits/stdc++.h>
using namespace std;
const int maxn = 100000 + 10, MOD = 1000 * 1000 * 1000 + 7,
          INF = 2 * 1000 * 1000 * 1000;
const double EPS = 1e-9;
int a[maxn], b[maxn];
long long best[maxn];
double X(int ind1, int ind2) {
  return 1.0 * (best[ind1] - best[ind2]) / (1.0 * (b[ind2] - b[ind1]));
}
int main() {
  int n, i, wline;
  deque<int> chull;
  while (cin >> n) {
    for (i = 0; i < n; ++i) cin >> a[i];
    for (i = 0; i < n; ++i) cin >> b[i];
    chull.clear();
    chull.push_back(0);
    best[0] = 0ll;
    wline = 0;
    for (i = 1; i < n; i++) {
      while (wline < chull.size() - 1 &&
             X(chull[wline + 1], chull[wline]) < 1.0 * a[i]) {
        wline++;
      }
      best[i] = best[chull[wline]] + b[chull[wline]] * 1ll * a[i];
      while (chull.size() >= 2 &&
             X(chull[chull.size() - 1], i) <
                 X(chull[chull.size() - 1], chull[chull.size() - 2])) {
        chull.pop_back();
        if (wline > chull.size()) wline--;
      }
      chull.push_back(i);
    }
    cout << best[n - 1] << endl;
  }
  return 0;
}
