#include <bits/stdc++.h>
using namespace std;
const int N = 1e6;
const long long INF = 1e18;
int n;
long long a[N], b[N], dp[N];
struct line {
  long long k, b;
  long double l, r;
  line(long long kk, long long bb, long double l1, long double r1) {
    k = kk;
    b = bb;
    l = l1;
    r = r1;
  }
};
vector<line> st;
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin >> n;
  for (int i = 0; i < n; i++) cin >> a[i];
  for (int i = 0; i < n; i++) cin >> b[i];
  dp[0] = 0;
  st.emplace_back(b[0], dp[0], -INF, INF);
  for (int i = 1; i < n; i++) {
    int l = -1, r = st.size();
    while (l + 1 < r) {
      int m = (l + r) / 2;
      if (st[m].l <= a[i])
        l = m;
      else
        r = m;
    }
    dp[i] = st[l].k * a[i] + st[l].b;
    for (;;) {
      long double x =
          -(long double)(st.back().b - dp[i]) / (st.back().k - b[i]);
      if (x < st.back().l) {
        st.pop_back();
        st.back().r = INF;
      } else {
        st.back().r = x;
        st.emplace_back(b[i], dp[i], x, INF);
        break;
      }
    }
  }
  cout << dp[n - 1] << endl;
  return 0;
}
