#include <bits/stdc++.h>
using namespace std;
void read(bool out = 0) {}
const long long Q = -(1ll << 60);
struct line {
  long double m, p;
  mutable set<line>::iterator prev;
};
set<line>::iterator null;
bool operator<(const line &a, const line &b) {
  if (b.p != Q && a.p != Q) {
    return a.m > b.m;
  }
  if (b.p == Q) {
    if (a.prev == null) return true;
    bool ok = true;
    if ((a.prev->m - a.m) < 0) ok = !ok;
    if (ok)
      return (a.p - a.prev->p) < (a.prev->m - a.m) * b.m;
    else
      return (a.p - a.prev->p) > (a.prev->m - a.m) * b.m;
  } else {
    if (b.prev == null) return false;
    bool ok = true;
    if ((b.prev->m - b.m) < 0) ok = !ok;
    if (ok)
      return !((b.p - b.prev->p) < a.m * (b.prev->m - b.m));
    else
      return !((b.p - b.prev->p) > a.m * (b.prev->m - b.m));
  }
}
class convex_hull {
 public:
  set<line> convex;
  set<line>::iterator next(set<line>::iterator ii) {
    set<line>::iterator gg = ii;
    gg++;
    return gg;
  }
  set<line>::iterator prev(set<line>::iterator ii) {
    set<line>::iterator gg = ii;
    gg--;
    return gg;
  }
  bool bad(set<line>::iterator jj) {
    set<line>::iterator ii, kk;
    if (jj == convex.begin()) return false;
    kk = next(jj);
    if (kk == convex.end()) return false;
    ii = prev(jj);
    line a = *ii, c = *kk, b = *jj;
    bool ok = true;
    if ((b.m - a.m) < 0) ok = !ok;
    if ((b.m - c.m) < 0) ok = !ok;
    if (ok)
      return (c.p - b.p) * (b.m - a.m) <= (a.p - b.p) * (b.m - c.m);
    else
      return (c.p - b.p) * (b.m - a.m) >= (a.p - b.p) * (b.m - c.m);
  }
  void del(set<line>::iterator ii) {
    set<line>::iterator jj = next(ii);
    if (jj != convex.end()) {
      jj->prev = ii->prev;
    }
    convex.erase(ii);
  }
  void add(long long m, long long p) {
    null = convex.end();
    line g;
    g.m = m;
    g.p = p;
    set<line>::iterator ii = convex.find(g);
    if (ii != convex.end()) {
      if (ii->p <= p) return;
      del(ii);
    }
    convex.insert(g);
    ii = convex.find(g);
    set<line>::iterator jj = next(ii);
    if (jj != convex.end()) jj->prev = ii;
    if (ii != convex.begin())
      ii->prev = prev(ii);
    else
      ii->prev = convex.end();
    if (bad(ii)) {
      del(ii);
      return;
    }
    jj = next(ii);
    while (jj != convex.end() && bad(jj)) {
      del(jj);
      jj = next(ii);
    }
    if (ii != convex.begin()) {
      jj = prev(ii);
      while (ii != convex.begin() && bad(jj)) {
        del(jj);
        jj = prev(ii);
      }
    }
  }
  long long query(long long x) {
    null = convex.end();
    line y;
    y.m = x;
    y.p = Q;
    if (convex.size() == 0) {
      return (1ll << 61);
    }
    set<line>::iterator iii = convex.lower_bound(y);
    iii--;
    return iii->m * x + iii->p;
  }
};
class ConvexHullTrick {
 public:
  long long M[200003];
  long long B[200003];
  long long I[200003];
  int si;
  int pt;
  ConvexHullTrick() {
    si = 0;
    pt = 0;
  }
  void init() {
    si = 0;
    pt = 0;
  }
  bool bad(int a, int b, int c) {
    return (B[b] - B[a]) * (M[a] - M[c]) >= (B[c] - B[a]) * (M[a] - M[b]);
  }
  void add(long double m, long double b, int ind) {
    M[si] = m;
    B[si] = b;
    I[si] = ind;
    si++;
    while (si >= 3 && bad(si - 3, si - 2, si - 1)) {
      M[si - 2] = M[si - 1];
      B[si - 2] = B[si - 1];
      I[si - 2] = I[si - 1];
      si--;
    }
    if (pt >= si) {
      pt = si - 1;
    }
  }
  long double query(long double x) {
    if (si == 0) {
      return 1ll << 60;
    }
    if (pt >= si) {
      pt = si - 1;
    }
    while (pt < si - 1 && M[pt + 1] * x + B[pt + 1] < M[pt] * x + B[pt]) {
      pt++;
    }
    return M[pt] * x + B[pt];
  }
};
long long a[100009], b[100009];
long long dp[100009];
int main() {
  read();
  ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  long long n;
  cin >> n;
  for (int i = 0; i < n; i++) cin >> a[i];
  for (int i = 0; i < n; i++) cin >> b[i];
  convex_hull conv;
  dp[0] = b[0];
  conv.add(b[0], 0);
  for (int i = 1; i < n; i++) {
    dp[i] = conv.query(a[i]);
    conv.add(b[i], dp[i]);
  }
  cout << dp[n - 1];
}
