#include <bits/stdc++.h>
using namespace std;
void preproc() {}
void reset() {}
struct MinCHT {
  vector<pair<long long, long long> > ch;
  inline long long y(int Lidx, long long qx) {
    return (Lidx >= 0 and Lidx < (int)ch.size()
                ? ch[Lidx].first * qx + ch[Lidx].second
                : LLONG_MAX);
  }
  long long find(long long qx) {
    assert(!ch.empty() and "Empty convex hull!");
    long long mn = LLONG_MAX;
    int low = 0, high = (int)ch.size() - 2;
    if (low <= high) {
      while (low <= high) {
        int g = (low + high) / 2;
        if (y(g, qx) >= y(g + 1, qx))
          low = g + 1;
        else
          high = g - 1;
      }
      mn = min({mn, y(high, qx), y(high + 1, qx)});
    }
    mn = min(mn, y((int)ch.size() - 1, qx));
    return mn;
  };
  void insert(long long m, long long c) {
    auto Ix = [&](pair<long long, long long> l1,
                  pair<long long, long long> l2) -> long double {
      return ((long double)l1.second - l2.second) / (l2.first - l1.first);
    };
    pair<long long, long long> l3 = make_pair(m, c);
    while ((int)ch.size() >= 2) {
      int sz = (int)ch.size();
      pair<long long, long long> l2 = ch[sz - 1];
      pair<long long, long long> l1 = ch[sz - 2];
      if (Ix(l1, l3) <= Ix(l1, l2))
        ch.pop_back();
      else
        break;
    }
    ch.push_back(l3);
  }
};
void solve(int Tt) {
  int n;
  cin >> n;
  vector<long long> a(n);
  vector<long long> b(n);
  for (long long &x : a) cin >> x;
  for (long long &x : b) cin >> x;
  MinCHT cht;
  vector<long long> dp(n);
  cht.insert(b[0], dp[0]);
  for (int i = 1; i < n; ++i) {
    dp[i] = cht.find(a[i]);
    cht.insert(b[i], dp[i]);
  }
  cout << dp[n - 1] << '\n';
  return;
}
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  cout.precision(10);
  cout << fixed;
  preproc();
  int tc = 1;
  for (int Tt = 1; Tt <= tc; ++Tt) {
    ;
    reset();
    solve(Tt);
  }
  return EXIT_SUCCESS;
}
