#include <bits/stdc++.h>
using namespace std;
const long long inf = 1e18 + 1;
const int MOD = 1e9 + 7;
const int dx[] = {+1, -1, 0, 0};
const int dy[] = {0, 0, +1, -1};
void frepik() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
}
struct line {
  long long k, b;
};
vector<line> s;
vector<long double> h;
int n;
long double intersect(line a, line b) {
  return (long double)(b.b - a.b) / (long double)(a.k - b.k);
}
void add(long long k, long long b) {
  if (s.size() < 2) {
    if (s.size() == 0)
      s.push_back({k, b});
    else {
      s.push_back({k, b});
      h.push_back(intersect(s[0], s[1]));
    }
  } else {
    while (s.size() > 1) {
      int n = s.size();
      long double f = intersect(s[n - 2], s[n - 1]);
      long double sc = intersect(s[n - 2], {k, b});
      if (f > sc) {
        s.pop_back();
        h.pop_back();
      } else
        break;
    }
    int n = s.size();
    s.push_back({k, b});
    h.push_back(intersect(s[n - 1], s[n]));
  }
}
long long get(long long k) {
  h.push_back(inf);
  int pos = lower_bound(h.begin(), h.end(), k) - h.begin();
  h.pop_back();
  return s[pos].k * k + s[pos].b;
}
int main() {
  frepik();
  cin >> n;
  vector<long long> a(n + 1), b(n + 1);
  for (int i = 1; i <= n; i++) cin >> a[i];
  for (int i = 1; i <= n; i++) cin >> b[i];
  vector<long long> dp(n + 1, inf);
  dp[1] = 0;
  add(b[1], 0);
  for (int i = 2; i <= n; i++) {
    dp[i] = get(a[i]);
    add(b[i], dp[i]);
  }
  cout << dp[n];
  return 0;
}
