#include <bits/stdc++.h>
using namespace std;
long long a[100010], b[100010];
struct Line {
  long long m, c;
};
vector<Line> s;
int ptr;
void add(long long m, long long c) {
  int i, j;
  i = (int)s.size() - 2;
  j = (int)s.size() - 1;
  while (i >= 0) {
    if ((double)(s[i].c - c) / (double)(m - s[i].m) <
        (double)(s[i].c - s[j].c) / (double)(s[j].m - s[i].m)) {
      --i;
      --j;
      s.erase(s.end() - 1);
    } else
      break;
  }
  s.push_back({m, c});
}
long long query(long long x) {
  int n = (int)s.size();
  long long c1, c2;
  while (ptr + 1 < n) {
    c1 = s[ptr].m * x + s[ptr].c;
    c2 = s[ptr + 1].m * x + s[ptr + 1].c;
    if (c2 < c1)
      ptr++;
    else
      break;
  }
  return s[ptr].m * x + s[ptr].c;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int n, i;
  cin >> n;
  for (i = 0; i < n; i++) cin >> a[i];
  for (i = 0; i < n; i++) cin >> b[i];
  s.push_back({b[0], 0});
  for (i = 1; i < n; i++) {
    add(b[i], query(a[i]));
  }
  cout << query(a[n - 1]) << '\n';
  return 0;
}
