#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e5 + 5;
long long a[maxn], b[maxn], dp[maxn];
int q[maxn];
int head = 0, tail = 0;
double A(int i, int j) { return dp[i] - dp[j]; }
double B(int i, int j) { return b[i] - b[j]; }
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int n;
  cin >> n;
  for (int i = 1; i <= n; i++) cin >> a[i];
  for (int i = 1; i <= n; i++) cin >> b[i];
  dp[1] = 0;
  int head = 1, tail = 1;
  q[tail] = 1;
  for (int i = 2; i <= n; i++) {
    while (head < tail &&
           A(q[head + 1], q[head]) / B(q[head + 1], q[head]) >= -a[i])
      head++;
    dp[i] = dp[q[head]] + b[q[head]] * a[i];
    while (head < tail && A(i, q[tail]) / B(i, q[tail]) >=
                              A(q[tail], q[tail - 1]) / B(q[tail], q[tail - 1]))
      tail--;
    q[++tail] = i;
  }
  cout << dp[n] << '\n';
  return 0;
}
