#include <bits/stdc++.h>
using namespace std;
struct Line {
  int k;
  long long b;
  Line(int k, long long b) : k(k), b(b) {}
};
void load(vector<int> &a, vector<int> &b) {
  int n;
  cin >> n;
  a.resize(n);
  for (int i = 0; i < n; ++i) {
    cin >> a[i];
  }
  b.resize(n);
  for (int i = 0; i < n; ++i) {
    cin >> b[i];
  }
}
long long get_best_value(vector<Line> &st, int &it, int x) {
  while (it + 1 < (int)st.size()) {
    Line l0 = st[it];
    Line l1 = st[it + 1];
    if (x * 1ll * (l0.k - l1.k) < l1.b - l0.b) break;
    ++it;
  }
  return st[it].k * 1ll * x + st[it].b;
}
void put(vector<Line> &st, Line l2, int &it) {
  while (st.size() > 1u) {
    Line l0 = *prev(st.end(), 2);
    Line l1 = *prev(st.end(), 1);
    if ((l1.b - l0.b) * 1.0L * (l1.k - l2.k) <
        (l2.b - l1.b) * 1.0L * (l0.k - l1.k))
      break;
    st.pop_back();
  }
  st.push_back(l2);
  it = min(it, (int)st.size() - 1);
}
long long solve(vector<int> &a, vector<int> &b) {
  vector<long long> dp(a.size());
  dp[0] = 0;
  vector<Line> st;
  st.push_back(Line(b[0], dp[0]));
  int it = 0;
  for (int i = 1; i < (int)a.size(); ++i) {
    dp[i] = get_best_value(st, it, a[i]);
    put(st, Line(b[i], dp[i]), it);
  }
  return dp.back();
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  vector<int> a, b;
  load(a, b);
  cout << solve(a, b) << endl;
  return 0;
}
