#include <bits/stdc++.h>
using namespace std;
const int MAXN = 102010;
const long long INF = 1000000009;
long long h[MAXN];
long long w[MAXN];
long long cost[MAXN];
long long A[MAXN];
long long B[MAXN];
int N;
int main() {
  while (cin >> N) {
    for (int i = 0; i < N; ++i) {
      scanf("%I64d", h + i);
    }
    for (int i = 0; i < N; ++i) {
      scanf("%I64d", w + i);
    }
    cost[0] = 0;
    A[0] = 0;
    B[0] = w[0];
    int n = 1;
    for (int i = 1; i < N; ++i) {
      int low = 0, high = n;
      while (low + 1 < high) {
        int mid = (low + high) / 2;
        if (A[mid] - A[mid - 1] > (B[mid - 1] - B[mid]) * h[i])
          high = mid;
        else
          low = mid;
      }
      cost[i] = h[i] * B[low] + A[low];
      if (cost[i] > INF * INF) continue;
      while (n > 1 &&
             (0.0 + cost[i] - A[n - 1]) / (-w[i] + B[n - 1]) <=
                 (0.0 + A[n - 1] - A[n - 2]) / (-B[n - 1] + B[n - 2])) {
        --n;
      }
      A[n] = cost[i];
      B[n++] = w[i];
    }
    cout << cost[N - 1] << endl;
  }
  return 0;
}
