#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e5 + 5;
const int INF = 1e9 + 7;
int n;
int a[maxn], b[maxn];
long long f[maxn];
class Line {
 public:
  long long k, b;
  Line() {}
  Line(long long k_, long long b_) : k(k_), b(b_) {}
  long long val(int x) { return k * x + b; }
};
inline double conj(const Line &l1, const Line &l2) {
  return (1.0 * l2.b - l1.b) / (l1.k - l2.k);
}
class ConvexHull {
 public:
  int top;
  Line stk[maxn];
  double p[maxn];
  ConvexHull() : top(0) {
    for (int i = (0); i < (maxn); ++i) p[i] = INF;
  }
  inline void insert(Line l) {
    if (!top)
      stk[++top] = l, p[top] = 0;
    else {
      for (; top >= 2 && conj(l, stk[top - 1]) < conj(stk[top], stk[top - 1]);
           --top)
        ;
      stk[++top] = l;
      p[top] = conj(stk[top], stk[top - 1]);
    }
    return;
  }
  inline long long query(int x) {
    int pos = lower_bound(p + 1, p + top + 1, x) - p - 1;
    return stk[pos].val(x);
  }
} hull;
int main() {
  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);
  f[0] = 0;
  for (int i = (1); i < (n); ++i) {
    hull.insert(Line(b[i - 1], f[i - 1]));
    f[i] = hull.query(a[i]);
  }
  printf("%lld\n", f[n - 1]);
  return 0;
}
