#include <bits/stdc++.h>
using namespace std;
template <typename T, bool MIN>
struct ConvexHullTrickAddMonotone {
  using Line = pair<T, T>;
  deque<Line> deq;
  using D = double;
  inline int sgn(T x) { return (x > 0) - (x < 0); }
  inline bool check(const Line &a, const Line &b, const Line &c) {
    if (b.second == a.second || c.second == b.second)
      return sgn(b.first - a.first) * sgn(c.second - b.second) >=
             sgn(c.first - b.first) * sgn(b.second - a.second);
    return D(b.first - a.first) * sgn(c.second - b.second) /
               abs(b.second - a.second) >=
           D(c.first - b.first) * sgn(b.second - a.second) /
               abs(c.second - b.second);
  }
  inline T f(const Line &a, const T x) { return a.first * x + a.second; }
  void add_line(T a, T b) {
    if (!MIN) a = -a, b = -b;
    Line line(a, b);
    if (deq.empty()) return (void)deq.emplace_back(line);
    if (deq.front().first <= a) {
      if (deq.front().first == a) {
        if (deq.front().second <= b) return;
        deq.pop_front();
      }
      while (deq.size() >= 2 && check(line, deq.front(), deq[1]))
        deq.pop_front();
      deq.emplace_front(line);
    } else {
      if (deq.back().first == a) {
        if (deq.back().second <= b) return;
        deq.pop_back();
      }
      while (deq.size() >= 2 && check(deq[deq.size() - 2], deq.back(), line))
        deq.pop_back();
      deq.emplace_back(line);
    }
  }
  T query(T x) {
    int l = -1, r = deq.size() - 1;
    while (l + 1 < r) {
      int m = (l + r) >> 1;
      (f(deq[m], x) >= f(deq[m + 1], x) ? l : r) = m;
    }
    return MIN ? f(deq[r], x) : -f(deq[r], x);
  }
  T query_monotone_inc(T x) {
    while (deq.size() >= 2 && f(deq.front(), x) >= f(deq[1], x))
      deq.pop_front();
    return MIN ? f(deq.front(), x) : -f(deq.front(), x);
  }
  T query_monotone_dec(T x) {
    while (deq.size() >= 2 && f(deq.back(), x) >= f(deq[deq.size() - 2], x))
      deq.pop_back();
    return MIN ? f(deq.back(), x) : -f(deq.back(), x);
  }
};
const long long INF = 1LL << 60;
int main() {
  int n;
  cin >> n;
  vector<long long> a(n);
  for (auto &ai : a) cin >> ai;
  vector<long long> b(n);
  for (auto &bi : b) cin >> bi;
  vector<long long> dp(n, INF);
  ConvexHullTrickAddMonotone<long long, true> cht;
  cht.add_line(b[0], dp[0] = 0);
  for (int i = 1; i < n; i++) {
    cht.add_line(b[i], dp[i] = cht.query_monotone_inc(a[i]));
  }
  cout << dp[n - 1] << endl;
  return 0;
}
