#include <bits/stdc++.h>
using namespace std;
inline int rei() {
  int x;
  cin >> x;
  return x;
}
inline string res() {
  string x;
  cin >> x;
  return x;
}
struct ConvexHullTrick {
  vector<pair<long long, long long>> Point;
  ConvexHullTrick() {}
  void Add(long long a, long long b) {
    while (Point.size() >= 2 &&
           !Need(Point[Point.size() - 2], Point[Point.size() - 1], {a, b})) {
      Point.pop_back();
    }
    Point.push_back({a, b});
  }
  long long Query(long long x) { return Calc(x, findMax(x)); }
  int findMax(long long x) {
    int bf = 0;
    int bl = Point.size() - 1;
    while (bf != bl) {
      int bc = (bf + bl) / 2;
      if (bc == Point.size() - 1 || Calc(x, bc) >= Calc(x, bc + 1)) {
        bl = bc;
      } else {
        bf = bc + 1;
      }
    }
    return bf;
  }
  long long Calc(long long x, int i) {
    return Point[i].first * x + Point[i].second;
  }
  bool Need(pair<long long, long long> p1, pair<long long, long long> p2,
            pair<long long, long long> p3) {
    return (double)(p2.first - p1.first) * (p2.second - p3.second) >
           (double)(p3.first - p2.first) * (p1.second - p2.second);
  }
};
long long A[100000];
long long B[100000];
void Calc() {
  int N = rei();
  for (int i = 0; i < N; i++) {
    A[i] = rei();
  }
  for (int i = 0; i < N; i++) {
    B[i] = rei();
  }
  ConvexHullTrick CHT;
  for (int i = 0; i < N - 1; i++) {
    if (A[i] == 1) {
      CHT.Add(-B[i], 0);
    } else {
      long long cost = CHT.Query(A[i]);
      CHT.Add(-B[i], cost);
    }
  }
  long long ans = CHT.Query(A[N - 1]);
  ans = -ans;
  cout << ans << endl;
}
int main(int argc, char** argv) {
  ios::sync_with_stdio(false), cin.tie(0);
  cout.tie(0);
  Calc();
  return 0;
}
