#include <bits/stdc++.h>
using namespace std;
int N;
long long A[100005], B[100005], DP[100005];
struct line {
  long long m, c;
  long long eval(long long x) { return m * x + c; }
  long double intersectX(line l) { return (long double)(c - l.c) / (l.m - m); }
};
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cin >> N;
  for (int i = 1; i <= N; i++) cin >> A[i];
  for (int i = 1; i <= N; i++) cin >> B[i];
  if (N == 1) {
    cout << 0 << '\n';
    return 0;
  }
  deque<line> dq;
  dq.push_front({B[1], 0});
  for (int i = 2; i <= N; i++) {
    long long xi = A[i];
    while (dq.size() >= 2 && dq.front().eval(xi) >= dq[1].eval(xi))
      dq.pop_front();
    DP[i] = dq.front().eval(xi);
    line cur = {B[i], DP[i]};
    while (dq.size() >= 2 &&
           cur.intersectX(dq.back()) <= dq.back().intersectX(dq[dq.size() - 2]))
      dq.pop_back();
    dq.push_back(cur);
  }
  cout << DP[N] << '\n';
  return 0;
}
