#include <bits/stdc++.h>
using namespace std;
long long a[100000];
long long b[100000];
long long dp[100000];
int main() {
  int n;
  cin >> n;
  for (int i = 0; i < n; ++i) {
    cin >> a[i];
  }
  for (int i = 0; i < n; ++i) {
    cin >> b[i];
  }
  vector<pair<double, pair<long long, long long> > > cute;
  cute.push_back({0, {0, b[0]}});
  long long ans2 = 1e18;
  long long ans = 0;
  for (int i = 1; i < n; ++i) {
    long long lo = 0;
    long long hi = cute.size() - 1;
    long long h = a[i];
    long long best = 0;
    for (; lo <= hi;) {
      long long mid = (lo + hi) >> 1;
      if (cute[mid].first <= h) {
        best = max(best, mid);
        lo = mid + 1;
      } else {
        hi = mid - 1;
      }
    }
    long long q = cute[best].second.first + cute[best].second.second * h;
    ans = q;
    ans2 = 1e18;
    for (; cute.size();) {
      pair<double, pair<long long, long long> > lol = cute.back();
      if ((double)lol.second.first + lol.second.second * lol.first >=
          (double)q + b[i] * lol.first - 0.00001) {
        cute.pop_back();
      } else {
        long double w =
            (double(q - lol.second.first)) / (double)(lol.second.second - b[i]);
        if (w > 1e10) goto ohi;
        cute.push_back({w, {q, b[i]}});
        goto ohi;
      }
    }
    if (cute.size() == 0) cute.push_back({0, {q, b[i]}});
  ohi:;
  }
  cout << ans << '\n';
}
