#include <bits/stdc++.h>
using namespace std;
const long long is_query = -(1LL << 62);
struct Line {
  long long m, b;
  mutable function<const Line *()> succ;
  bool operator<(const Line &rhs) const {
    if (rhs.b != is_query) return m > rhs.m;
    const Line *s = succ();
    if (!s) return 0;
    long long x = rhs.m;
    return b - s->b > (s->m - m) * x;
  }
};
struct CHT : public multiset<Line> {
  bool bad(iterator y) {
    auto z = next(y);
    if (y == begin()) {
      if (z == end()) return 0;
      return y->m == z->m && y->b >= z->b;
    }
    auto x = prev(y);
    if (z == end()) return y->m == x->m && y->b >= x->b;
    return double(x->b - y->b) * (z->m - y->m) >=
           double(y->b - z->b) * (y->m - x->m);
  }
  void insert_line(long long m, long long b) {
    auto y = insert({m, b});
    y->succ = [=] { return next(y) == end() ? 0 : &*next(y); };
    if (bad(y)) {
      erase(y);
      return;
    }
    while (next(y) != end() && bad(next(y))) erase(next(y));
    while (y != begin() && bad(prev(y))) erase(prev(y));
  }
  long long eval(long long x) {
    auto l = *lower_bound((Line){x, is_query});
    return l.m * x + l.b;
  }
};
struct pts {
  long long b, a;
};
CHT cht;
pts P[(int)1e6 + 5];
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  ;
  int n;
  cin >> n;
  for (int x = 0; x < n; x++) cin >> P[x].a;
  for (int x = 0; x < n; x++) cin >> P[x].b;
  cht.insert_line(P[0].b, 0);
  long long ans = 0;
  for (int x = 0; x < n; x++) {
    long long C = cht.eval(P[x].a);
    ans = C;
    cht.insert_line(P[x].b, C);
  }
  cout << ans << "\n";
}
