#include <bits/stdc++.h>
using namespace std;
long long a[100005], b[100005], dp[100005], ptr, n;
vector<pair<long long, long long>> line;
void add(long long m, long long c) {
  long long sz = line.size();
  while (line.size() >= 2 &&
         ((c - line[sz - 1].second + 0.00) / (line[sz - 1].first - m + 0.00)) <=
             ((c - line[sz - 2].second + 0.00) /
              (line[sz - 2].first - m + 0.00))) {
    line.pop_back();
    sz = line.size();
  }
  line.push_back({m, c});
}
long long query(long long x) {
  if (ptr >= line.size()) ptr = line.size() - 1;
  while (ptr + 1 < line.size() &&
         line[ptr].first * x + line[ptr].second >
             line[ptr + 1].first * x + line[ptr + 1].second)
    ptr++;
  return line[ptr].first * x + line[ptr].second;
}
int main() {
  cin >> n;
  for (long long i = 1; i <= n; i++) {
    cin >> a[i];
  }
  for (long long i = 1; i <= n; i++) {
    cin >> b[i];
  }
  dp[1] = 0;
  for (long long i = 1; i <= n; i++) {
    if (i > 1) dp[i] = query(a[i]);
    if (i < n) add(b[i], dp[i]);
  }
  cout << dp[n] << endl;
}
