#include <bits/stdc++.h>
using namespace std;
using lli = long long int;
using ll = lli;
using llu = unsigned long long int;
using pii = tuple<lli, lli>;
using piii = tuple<lli, lli, lli>;
using vi = vector<lli>;
using vii = vector<pii>;
using viii = vector<piii>;
using vvi = vector<vi>;
using vvii = vector<vii>;
using vviii = vector<viii>;
using vb = vector<bool>;
using vvb = vector<vb>;
using ld = long double;
struct StaticCHT {
  vi a, b;
  int hd, tl;
  StaticCHT(int n) : a(n), b(n) { hd = tl = 0; }
  void add(lli a0, lli b0) {
    while (tl - hd >= 2) {
      lli a1 = a[tl - 1], b1 = b[tl - 1];
      lli a2 = a[tl - 2], b2 = b[tl - 2];
      if (ld(b0 - b2) * (a1 - a0) < ld(b0 - b1) * (a2 - a0)) break;
      tl--;
    }
    a[tl] = a0;
    b[tl] = b0;
    tl++;
  }
  lli query(lli x0) {
    while (tl - hd >= 2) {
      if (x0 * a[hd] + b[hd] < x0 * a[hd + 1] + b[hd + 1]) break;
      hd++;
    }
    return x0 * a[hd] + b[hd];
  }
};
const lli QUERY = LLONG_MIN;
struct Line {
  lli a, b;
  mutable function<const Line *()> succ;
  bool operator<(const Line &o) const {
    if (o.b != QUERY) return a > o.a;
    const Line *s = succ();
    if (s == NULL) return false;
    return b - s->b > (s->a - a) * o.a;
  }
};
struct DynamicCHT : public multiset<Line> {
  bool bad(iterator y) {
    auto z = next(y);
    if (y == begin()) {
      if (z == end()) return false;
      return y->a == z->a && y->b >= z->b;
    }
    auto x = prev(y);
    if (z == end()) return y->a == x->a && y->b >= x->b;
    return ld(x->b - y->b) * (z->a - y->a) >= ld(y->b - z->b) * (y->a - x->a);
  }
  void add(lli a, lli b) {
    auto y = insert({a, b, nullptr});
    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));
  }
  lli query(lli x) {
    auto l = *lower_bound((Line){x, QUERY, nullptr});
    return l.a * x + l.b;
  }
};
int main() {
  int n;
  scanf("%d", &n);
  vi a(n), b(n);
  for (lli i = 0; i < (lli)(n); ++i) scanf("%lld", &a[i]);
  for (lli i = 0; i < (lli)(n); ++i) scanf("%lld", &b[i]);
  StaticCHT cht(n);
  cht.add(b[0], 0);
  lli ans;
  for (lli i = (lli)(1); i < (lli)(n); ++i) {
    ans = cht.query(a[i]);
    cht.add(b[i], ans);
  }
  printf("%lld\n", ans);
}
