#include <bits/stdc++.h>
using namespace std;
const int MAXN = 100500;
long long a[MAXN], b[MAXN], dp[MAXN], q[MAXN];
bool bad(long long l1, long long l2, long long l3) {
  bool ta = (dp[q[l3]] - dp[q[l1]] + 0.0) / (dp[q[l3]] - dp[q[l2]] + 0.0) >
            (b[q[l1]] - b[q[l3]] + 0.0) / (b[q[l2]] - b[q[l3]] + 0.0);
  if (dp[q[l3]] - dp[q[l2]] < 0) ta = !ta;
  if (dp[q[l3]] - dp[q[l1]] < 0) ta = !ta;
  return ta;
}
long long calc(int p, int g) { return dp[p] + b[p] * a[g]; }
int main() {
  int n;
  cin >> n;
  for (int i = 0; i < n; i++) cin >> a[i];
  for (int i = 0; i < n; i++) cin >> b[i];
  int h = 0, t = 0;
  q[0] = 0;
  for (int i = 1; i < n; i++) {
    while (h < t && calc(q[h], i) > calc(q[h + 1], i)) h++;
    dp[i] = calc(q[h], i);
    q[++t] = i;
    while (t - h > 1 && bad(t - 2, t - 1, t)) q[--t] = i;
  }
  cout << dp[n - 1] << endl;
  return 0;
}
