#include <bits/stdc++.h>
using namespace std;
long long dp[(int)1e5 + 5];
int main() {
  int n;
  cin >> n;
  vector<long long> v(n), v2(n);
  for (int x = 0; x < n; x++) {
    cin >> v[x];
    dp[x] = 2e18;
  }
  for (int x = 0; x < n; x++) {
    cin >> v2[x];
  }
  vector<pair<double, int> > ranges;
  ranges.push_back({-2e9, 0});
  dp[0] = 0;
  for (int x = 1; x < n; x++) {
    int i =
        lower_bound(ranges.begin(), ranges.end(), pair<double, int>(v[x], -1)) -
        ranges.begin() - 1;
    i = ranges[i].second;
    dp[x] = dp[i] + v2[i] * v[x];
    while (ranges.size() > 1) {
      double in3 =
          (dp[ranges.back().second] - dp[ranges[ranges.size() - 2].second] +
           .0) /
          (v2[ranges[ranges.size() - 2].second] - v2[ranges.back().second]);
      double in2 = (dp[ranges[ranges.size() - 2].second] - dp[x] + .0) /
                   (v2[x] - v2[ranges[ranges.size() - 2].second]);
      if (in3 >= in2)
        ranges.pop_back();
      else
        break;
    }
    double in = (dp[ranges.back().second] - dp[x] + .0) /
                (v2[x] - v2[ranges.back().second]);
    ranges.push_back({in, x});
  }
  cout << dp[n - 1] << endl;
}
