#include <bits/stdc++.h>
using namespace std;
int n, a[100000 + 10], b[100000 + 10];
long long dp[100000 + 10];
double eps = 1e-10;
pair<double, pair<long long, long long> > v[100000 + 10];
int sz = 0;
bool equal(double a, double b, double eps) { return abs(a - b) < eps; }
long long findmin(long long x) {
  int lt = 0, rt = sz;
  while (rt - lt > 1) {
    int mid = (lt + rt) >> 1;
    if (x < v[mid].first)
      rt = mid;
    else
      lt = mid;
  }
  return v[lt].second.first * x + v[lt].second.second;
}
void put(pair<long long, long long> pr) {
  int lt = 0, rt = sz;
  while (rt - lt > 1) {
    int mid = (lt + rt) >> 1;
    double va, vb;
    va = pr.first * v[mid].first + pr.second;
    vb = v[mid].first * v[mid].second.first + v[mid].second.second;
    if (equal(va, vb, eps)) {
      v[mid].second = pr;
      sz = mid + 1;
      return;
    } else {
      if (va < vb)
        rt = mid;
      else
        lt = mid;
    }
  }
  sz = lt + 1;
  v[sz] = make_pair(
      1.0 * (v[lt].second.second - pr.second) / (pr.first - v[lt].second.first),
      pr);
  ++sz;
}
int main() {
  int n;
  cin >> n;
  for (int i = 0; i < n; ++i) scanf("%d", &a[i]);
  for (int i = 0; i < n; ++i) scanf("%d", &b[i]);
  dp[0] = 0;
  v[sz++] = make_pair(0, make_pair(b[0], 0));
  for (int i = 1; i < n; ++i) {
    dp[i] = findmin(a[i]);
    put(make_pair(b[i], dp[i]));
  }
  cout << dp[n - 1];
  return 0;
}
