#include <bits/stdc++.h>
const long double pi = 3.1415926535898;
const long long mod = 1e9 + 7;
using namespace std;
struct Line {
  long long m, c;
  Line(long long am, long long ac) {
    m = am;
    c = ac;
  }
  long long value(long long x) { return m * x + c; }
};
struct CHT {
  vector<Line> lines;
  vector<long long> cords;
  CHT() : lines(), cords() {}
  void add(Line L) {
    while (lines.size()) {
      if (L.value(cords.back()) <= lines.back().value(cords.back())) {
        lines.pop_back();
        cords.pop_back();
      } else {
        break;
      }
    }
    long long inf = 1e9 + 5;
    if (lines.empty()) {
      cords.push_back(-inf);
      lines.push_back(L);
      return;
    }
    long long low = cords.back(), high = inf + 1;
    long long best = high;
    while (low <= high) {
      long long x = (low + high) / 2;
      if (L.value(x) <= lines.back().value(x)) {
        best = x;
        high = x - 1;
      } else {
        low = x + 1;
      }
    }
    if (best != inf + 1) {
      cords.push_back(best);
      lines.push_back(L);
    }
  }
  long long get(long long x) {
    long long p =
        upper_bound(cords.begin(), cords.end(), x) - cords.begin() - 1;
    return lines[p].value(x);
  }
};
int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  long long n;
  cin >> n;
  long long a[n], b[n];
  for (long long i = 0; i < n; i++) {
    cin >> a[i];
  }
  for (long long i = 0; i < n; i++) {
    cin >> b[i];
  }
  CHT cht = CHT();
  cht.add(Line(b[0], 0));
  long long ans = 0;
  for (long long i = 1; i < n; i++) {
    long long cur = cht.get(a[i]);
    cht.add(Line(b[i], cur));
    ans = cur;
  }
  cout << ans;
  return 0;
}
