#include <bits/stdc++.h>
using namespace std;
const string NAME = "319";
const int N = 101010;
struct line {
  long long a, b;
  long long val(long long x) { return a * x + b; }
  double giaoX(line v) { return 1.0 * (v.b - b) / (a - v.a); }
};
struct convexhull {
  vector<line> dq;
  void insert(line u) {
    while (dq.size() > 1 &&
           dq[dq.size() - 1].giaoX(u) <= dq[dq.size() - 2].giaoX(u))
      dq.pop_back();
    dq.push_back(u);
  }
  long long query(long long x) {
    long long l = 0, r = dq.size() - 1, m1, m2, ans = 1e18;
    while (r - l > 3) {
      m1 = l + (r - l) / 3;
      m2 = r - (r - l) / 3;
      if (dq[m1].val(x) < dq[m2].val(x))
        r = m2;
      else
        l = m1;
    }
    for (int i = l; i <= r; i++) ans = min(ans, dq[i].val(x));
    return ans;
  }
} hull;
long long n, a[N], b[N], dp[N];
int main() {
  ios::sync_with_stdio(0);
  cin >> n;
  for (int i = 1; i <= n; i++) cin >> a[i];
  for (int i = 1; i <= n; i++) cin >> b[i];
  dp[1] = 0;
  hull.insert((line){b[1], 0});
  for (int i = 2; i <= n; i++) {
    dp[i] = hull.query(a[i]);
    hull.insert((line){b[i], dp[i]});
  }
  cout << dp[n];
  return 0;
}
