#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 10;
const long long DUMMY = LLONG_MIN;
class LowerLine {
 public:
  long long m, b;
  mutable function<const LowerLine*()> succ;
  bool operator<(const LowerLine& rhs) const {
    if (rhs.b != DUMMY) return m > rhs.m;
    const LowerLine* s = succ();
    if (!s) return 0;
    long long x = rhs.m;
    return double(b - s->b) / double(s->m - m) < x;
  }
};
class DynamicConvexHull : public multiset<LowerLine> {
 public:
  void Insert(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 Query(long long x) {
    assert(empty() == false);
    auto l = *lower_bound({x, DUMMY});
    return l.m * x + l.b;
  }

 private:
  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) * double(z->m - y->m) >=
           double(y->b - z->b) * double(y->m - x->m);
  }
};
long long n, a[N], b[N], dp[N];
int main() {
  ios::sync_with_stdio(0), cin.tie(0), cout.setf(ios::fixed), cout.precision(9);
  cin >> n;
  for (int i = 0; i < n; ++i) cin >> a[i];
  for (int i = 0; i < n; ++i) cin >> b[i];
  DynamicConvexHull hull;
  hull.Insert(b[0], dp[0]);
  for (int i = 1; i < n; ++i) {
    dp[i] = hull.Query(a[i]);
    hull.Insert(b[i], dp[i]);
  }
  cout << dp[n - 1] << '\n';
}
