#include <bits/stdc++.h>
using namespace std;
long long A[100005], B[100005];
long long dp[100005];
long long M[100005], C[100005];
int tot;
void add(long long m, long long c) {
  while (tot >= 2 &&
         (long double)(c - C[tot - 2]) / (M[tot - 2] - m) <
             (long double)(C[tot - 1] - C[tot - 2]) / (M[tot - 2] - M[tot - 1]))
    tot--;
  M[tot] = m;
  C[tot++] = c;
}
int main() {
  int n;
  cin >> n;
  for (auto(i) = (1); (i) < (n + 1); (i)++) {
    int a;
    cin >> a;
    A[i] = a;
  }
  for (auto(i) = (1); (i) < (n + 1); (i)++) {
    int a;
    cin >> a;
    B[i] = a;
  }
  add(B[1], 0);
  int cur = 0;
  for (auto(i) = (2); (i) < (n + 1); (i)++) {
    while (cur + 1 < tot &&
           A[i] * M[cur + 1] + C[cur + 1] < A[i] * M[cur] + C[cur])
      cur++;
    dp[i] = A[i] * M[cur] + C[cur];
    add(B[i], dp[i]);
  }
  cout << dp[n] << endl;
  return 0;
}
