#include <bits/stdc++.h>
using namespace std;
long long a[100005], b[100005], dp[100005];
deque<pair<long long, long long> > dq;
bool valid(pair<long long, long long> p1, pair<long long, long long> p2,
           pair<long long, long long> p3) {
  long long a1 = p1.first, b1 = p1.second;
  long long a2 = p2.first, b2 = p2.second;
  long long a3 = p3.first, b3 = p3.second;
  long double c = b3 - b1;
  long double d = a1 - a3;
  long double e = b2 - b1;
  long double f = a1 - a2;
  return c * f <= d * e;
}
long long solve(long long x) {
  int esq = 0, dir = dq.size() - 1;
  while (esq <= dir) {
    int mid = (esq + dir) / 2;
    int okesq = 0, okdir = 0;
    if (mid == 0)
      okesq = 1;
    else {
      long double a1 = dq[mid - 1].first, b1 = dq[mid - 1].second;
      long double a2 = dq[mid].first, b2 = dq[mid].second;
      okesq = (b2 - b1) <= (a1 - a2) * x;
    }
    if (mid == dq.size() - 1)
      okdir = 1;
    else {
      long double a1 = dq[mid].first, b1 = dq[mid].second;
      long double a2 = dq[mid + 1].first, b2 = dq[mid + 1].second;
      okdir = x * (a1 - a2) <= (b2 - b1);
    }
    if (okesq and okdir)
      return x * dq[mid].first + dq[mid].second;
    else if (!okdir)
      esq = mid + 1;
    else
      dir = mid - 1;
  }
  exit(-1);
  return 1e12;
}
int main() {
  int n;
  cin >> n;
  for (int i = 1; i <= n; i++) cin >> a[i];
  for (int i = 1; i <= n; i++) cin >> b[i];
  for (int i = 1; i <= n; i++) dp[i] = 1e18;
  dp[1] = 0;
  dq.push_back(pair<long long, long long>(b[1], dp[1]));
  for (int i = 2; i <= n; i++) {
    dp[i] = solve(a[i]);
    pair<long long, long long> p = pair<long long, long long>(b[i], dp[i]);
    while (dq.size() > 1 and valid(dq[dq.size() - 2], dq[dq.size() - 1], p)) {
      dq.pop_back();
    }
    dq.push_back(p);
  }
  cout << dp[n] << endl;
  return 0;
}
