#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 7;
const long long INF = 1e18 + 7;
const double EPS = 1e-12;
int n, a[N], b[N];
struct SlopeOp {
  deque<pair<long long, long long> > q;
  void push(long long x, long long y) {
    while (((int)(q).size()) > 1) {
      if (log(q.back().second - q[((int)(q).size()) - 2].second) +
              log(x - q.back().first) + EPS <
          log(y - q.back().second) +
              log(q.back().first - q[((int)(q).size()) - 2].first))
        break;
      q.pop_back();
    }
    q.push_back(make_pair(x, y));
  }
  long long get(long long x) {
    if (q.empty()) return INF;
    while (((int)(q).size()) > 1 &&
           (q[0].second - q[1].second) >= x * (q[0].first - q[1].first))
      q.pop_front();
    return -x * q[0].first + q[0].second;
  }
} so;
int main() {
  scanf("%d", &n);
  for (int i = (0); i < (n); ++i) scanf("%d", &a[i]);
  for (int i = (0); i < (n); ++i) scanf("%d", &b[i]);
  so.push(-b[0], 0);
  for (int i = (1); i < (n - 1); ++i) {
    long long dp = so.get(a[i]);
    so.push(-b[i], dp);
  }
  printf("%lld", so.get(a[n - 1]));
  return 0;
}
