#include <bits/stdc++.h>
using namespace std;
const int dirs[8][2] = {
    1, 0, 0, 1, -1, 0, 0, -1, 1, 1, 1, -1, -1, 1, -1, -1,
};
const int maxn = 100005;
int a[maxn];
int b[maxn];
int n;
long long dp[maxn];
pair<long long, long long> hull[maxn];
int hcnt = 0;
long double intersect(long long a1, long long b1, long long a2, long long b2) {
  return (long double)(b2 - b1) / (a1 - a2);
}
long long func(long long x, int i) {
  return x * hull[i].first + hull[i].second;
}
void add(long long a, long long b) {
  hull[hcnt] = make_pair(a, b);
  hcnt++;
  while (hcnt > 2) {
    if (intersect(hull[hcnt - 1].first, hull[hcnt - 1].second,
                  hull[hcnt - 2].first, hull[hcnt - 2].second) <
        intersect(hull[hcnt - 1].first, hull[hcnt - 1].second,
                  hull[hcnt - 3].first, hull[hcnt - 3].second)) {
      hull[hcnt - 2] = hull[hcnt - 1];
      hcnt--;
    } else {
      break;
    }
  }
}
bool possibly(int mid, long long x) {
  if (mid == hcnt - 1) return true;
  return func(x, mid) <= func(x, mid + 1);
}
long long get(long long x) {
  int lo = -1;
  int hi = hcnt;
  while (hi - lo > 1) {
    int mid = (lo + hi) / 2;
    if (possibly(mid, x))
      hi = mid;
    else
      lo = mid;
  }
  return func(x, hi);
}
int main(int argc, char **argv) {
  scanf("%d", &n);
  for (int i = 0; i < n; i++) scanf("%d", a + i);
  for (int i = 0; i < n; i++) scanf("%d", b + i);
  dp[0] = b[0];
  add(b[0], dp[0]);
  for (int i = 1; i < n; i++) {
    dp[i] = get(a[i] - 1) + b[i];
    add(b[i], dp[i]);
  }
  cout << dp[n - 1];
  return 0;
}
