#include <bits/stdc++.h>
using namespace std;
const long long N = 1e6 + 9;
const long long M = 1e2 + 9;
const long long INFINT = 1e9 + 9;
const long long INFLL = 1e18 + 9;
const long double EPS = 1e-12;
struct str {
  long double k, b, l, r;
  str(long double k, long double b, long double l, long double r) {
    this->k = k;
    this->b = b;
    this->l = l;
    this->r = r;
  }
};
signed main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  long long n;
  cin >> n;
  vector<long double> a(n), b(n), dp(N);
  for (long long i = 0; i < n; i++) cin >> a[i];
  for (long long i = 0; i < n; i++) cin >> b[i];
  dp[0] = 0;
  vector<str> st;
  st.push_back(str(b[0], 0, -INFLL, INFLL));
  for (long long i = 1; i < n; i++) {
    long long l = 0, r = st.size();
    while (l + 1 < r) {
      long long m = (l + r) >> 1;
      if (st[m].l <= a[i])
        l = m;
      else
        r = m;
    }
    dp[i] = st[l].k * a[i] + st[l].b;
    while (st.size() > 1 &&
           (st.back().b - dp[i]) / (b[i] - st.back().k) < st.back().l) {
      st.pop_back();
      st.back().r = INFLL;
    }
    long double first = (st.back().b - dp[i]) / (b[i] - st.back().k);
    st.back().r = first;
    st.push_back(str(b[i], dp[i], first, INFLL));
  }
  long long ans = round(dp[n - 1]);
  cout << ans;
  return 0;
}
