#include <bits/stdc++.h>
using namespace std;
int INP, AM, REACHEOF;
const int BUFSIZE = (1 << 12) + 17;
char BUF[BUFSIZE + 1], *inp = BUF;
const int MN = 100111;
int n, top;
long long a[MN], b[MN], f[MN];
pair<long long, long long> x[MN];
double pos[MN];
void addLine(long long f3, long long b3) {
  while (top > 1) {
    long long f1 = x[top - 1].first, b1 = x[top - 1].second;
    long long f2 = x[top].first, b2 = x[top].second;
    if ((f3 - f1) / (b1 - b3) <= (f2 - f1) / (b1 - b2))
      --top;
    else
      break;
  }
  pos[top + 1] = (f3 - x[top].first) / (double)(x[top].second - b3);
  x[++top] = make_pair(f3, b3);
}
long long get(long long a) {
  pos[top + 1] = 1e50;
  int id = upper_bound(pos + 1, pos + top + 2, a) - pos - 1;
  return x[id].first + x[id].second * a;
}
int main() {
  while (cin >> n) {
    for (int i = (1), _b = (n); i <= _b; i++) cin >> a[i];
    for (int i = (1), _b = (n); i <= _b; i++) cin >> b[i];
    f[1] = 0;
    x[top = 1] = make_pair(f[1], b[1]);
    pos[1] = 0;
    for (int i = (2), _b = (n); i <= _b; i++) {
      f[i] = get(a[i]);
      addLine(f[i], b[i]);
    }
    cout << f[n] << endl;
  }
  return 0;
}
