#include <bits/stdc++.h>
using namespace std;
struct CHT {
  vector<long long> m, b;
  int ptr = 0;
  bool bad(int l1, int l2, int l3) {
    return 1.0 * (b[l3] - b[l1]) * (m[l1] - m[l2]) <
           1.0 * (b[l2] - b[l1]) * (m[l1] - m[l3]);
  }
  void add(long long _m, long long _b) {
    m.push_back(_m);
    b.push_back(_b);
    int s = m.size();
    while (s >= 3 && bad(s - 3, s - 2, s - 1)) {
      s--;
      m.erase(m.end() - 2);
      b.erase(b.end() - 2);
    }
  }
  long long f(int i, long long x) { return m[i] * x + b[i]; }
  long long query(long long x) {
    if (ptr >= m.size()) ptr = m.size() - 1;
    while (ptr < m.size() - 1 && f(ptr + 1, x) < f(ptr, x)) ptr++;
    return f(ptr, x);
  }
};
int main(int argc, char const *argv[]) {
  int n;
  cin >> n;
  long long a[n], b[n];
  for (int i = 0; i < n; i++) cin >> a[i];
  for (int i = 0; i < n; i++) cin >> b[i];
  long long dp[n];
  CHT ds;
  dp[0] = 0;
  ds.add(b[0], 0);
  for (int i = 1; i < n; i++) {
    dp[i] = ds.query(a[i]);
    ds.add(b[i], dp[i]);
  }
  cout << dp[n - 1] << endl;
}
