#include <bits/stdc++.h>
using namespace std;
deque<pair<long long, long long> > lines;
void insert(long long m, long long c) {
  int sz = lines.size();
  while (sz > 1 &&
         (double)(c - lines[sz - 2].second) /
                 (double)(lines[sz - 2].first - m) <=
             (double)(lines[sz - 2].second - lines[sz - 1].second) /
                 (double)(lines[sz - 1].first - lines[sz - 2].first)) {
    lines.pop_back();
    sz--;
  }
  lines.push_back({m, c});
}
long long find(long long x) {
  if (lines.empty()) return 0;
  while (lines.size() > 1 && (lines[0].first * x + lines[0].second >
                              lines[1].first * x + lines[1].second))
    lines.pop_front();
  return lines[0].first * x + lines[0].second;
}
int main(int argc, char const *argv[]) {
  int n;
  cin >> n;
  long long ht[n], b[n];
  for (int i = 0; i < n; ++i) cin >> ht[i];
  for (int i = 0; i < n; ++i) cin >> b[i];
  long long dp[n + 1];
  dp[0] = 0;
  for (int i = 1; i < n; i++) {
    insert(b[i - 1], dp[i - 1]);
    dp[i] = find(ht[i]);
  }
  cout << dp[n - 1] << endl;
  return 0;
}
