#include <bits/stdc++.h>
using namespace std;
int dx[] = {1, -1, 0, 0};
int dy[] = {0, 0, -1, 1};
struct Line {
  long long m, b;
  Line(){};
  Line(long long _m, long long _b) {
    m = _m;
    b = _b;
  }
  bool operator<(Line other) const {
    if (m != other.m) return m > other.m;
    return b < other.b;
  }
  long long getVal(long long x) { return m * x + b; }
};
struct ConvexHullTrick {
  vector<Line> st;
  bool badLine(Line s, Line t, Line u) {
    return 1.0 * (t.b - s.b) * (s.m - u.m) >= 1.0 * (u.b - s.b) * (s.m - t.m);
  }
  void addLine(Line l) {
    while (st.size() >= 2 && badLine(st[st.size() - 2], st[st.size() - 1], l))
      st.pop_back();
    st.push_back(l);
  }
  long long query(long long x) {
    if (st.size() == 0) return 0x3F3F3F3F3F3F3F3FLL;
    int lo = 0, hi = st.size() - 1;
    while (lo < hi) {
      int md = (lo + hi) >> 1;
      if (st[md].getVal(x) <= st[md + 1].getVal(x))
        hi = md;
      else
        lo = md + 1;
    }
    return st[lo].getVal(x);
  }
};
const int N = 1000010;
ConvexHullTrick s;
long long a[N], b[N], pd[N];
long long n;
int main() {
  scanf("%lld", &n);
  for (int i = 0; i < n; ++i) scanf("%lld", a + i);
  for (int i = 0; i < n; ++i) scanf("%lld", b + i);
  pd[0] = 0;
  s.addLine(Line(b[0], pd[0]));
  for (int i = 1; i < n; ++i) {
    pd[i] = s.query(a[i]);
    s.addLine(Line(b[i], pd[i]));
  }
  printf("%lld\n", pd[n - 1]);
  return 0;
}
