#include <bits/stdc++.h>
using namespace std;
long long f[100005], a[100005], b[100005];
int n, last;
vector<pair<long long, long long> > Q;
long long lcl(pair<long long, long long> u, pair<long long, long long> v) {
  return (v.second - u.second + u.first - v.first - 1) / (u.first - v.first);
}
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) scanf("%I64d", &a[i]);
  for (int i = 1; i <= n; i++) scanf("%I64d", &b[i]);
  f[1] = 0;
  Q.push_back(pair<long long, long long>(b[1], f[1]));
  for (int i = 2; i <= n; i++) {
    while (last < Q.size() - 1 &&
           a[i] * Q[last].first + Q[last].second >=
               a[i] * Q[last + 1].first + Q[last + 1].second)
      last++;
    f[i] = a[i] * Q[last].first + Q[last].second;
    pair<long long, long long> x = pair<long long, long long>(b[i], f[i]);
    while (Q.size() > 1) {
      pair<long long, long long> u = Q[Q.size() - 2];
      pair<long long, long long> v = Q[Q.size() - 1];
      if (lcl(u, v) >= lcl(v, x))
        Q.pop_back();
      else
        break;
    }
    Q.push_back(x);
  }
  printf("%I64d\n", f[n]);
  return 0;
}
