#include <bits/stdc++.h>
using namespace std;
struct line {
  long long k, b;
  line() {}
  line(long long x, long long y) {
    k = x;
    b = y;
  };
};
line E[1 << 18];
int bg, ed;
long long a[1 << 17], b[1 << 17];
long long n;
long long dp[1 << 17];
double cross(line A, line B) { return (B.b - A.b) / (A.k - B.k); }
inline bool bad(line A, line B, line C) { return cross(A, C) > cross(A, B); }
inline void add(line L) {
  if (ed - bg < 1) {
    E[++ed] = L;
    return;
  }
  line l1, l2;
  while (ed - bg >= 1) {
    l2 = E[ed];
    l1 = E[ed - 1];
    if (bad(L, l2, l1))
      ed--;
    else
      break;
  }
  E[++ed] = L;
}
inline long long query(long long x) {
  long long l = 1, r = ed, mid;
  do {
    mid = (l + r + 1) / 2;
    if (cross(E[mid], E[mid - 1]) > (double)x) {
      r = mid - 1;
    } else
      l = mid;
  } while (l < r);
  return E[l].k * x + E[l].b;
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cin >> n;
  for (int i = 0; i < n; i++) cin >> a[i];
  for (int i = 0; i < n; i++) cin >> b[i];
  dp[0] = 0;
  E[0] = line((1 << 30), -(1 << 30));
  add(line(b[0], 0));
  for (int i = 1; i < n; i++) {
    dp[i] = query(a[i]);
    add(line(b[i], dp[i]));
  }
  cout << dp[n - 1] << endl;
  return 0;
}
