#include <bits/stdc++.h>
using namespace std;
constexpr int MAXN = (int)1e5;
struct Line {
  int m;
  long long c;
  long long operator()(int x) { return (long long)m * x + c; }
  double operator^(const Line &rhs) {
    return ((double)c - rhs.c) / ((double)rhs.m - m);
  }
};
struct ConvexHull {
  Line lines[MAXN + 1];
  int l = 0, r = 0;
  void operator+=(Line line) {
    while (r - l >= 2 &&
           (line ^ lines[r - 1]) <= (lines[r - 1] ^ lines[r - 2])) {
      r--;
    }
    lines[r] = line;
    r++;
  }
  long long operator()(int x) {
    while (r - l >= 2 && lines[l](x) >= lines[l + 1](x)) {
      l++;
    }
    return lines[l](x);
  }
} hull;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n;
  cin >> n;
  int h[n];
  for (int i = 0; i < n; i++) {
    cin >> h[i];
  }
  int c[n];
  for (int i = 0; i < n; i++) {
    cin >> c[i];
  }
  hull += Line{c[0], 0};
  long long dp;
  for (int i = 1; i < n; i++) {
    dp = hull(h[i]);
    hull += Line{c[i], dp};
  }
  cout << dp << '\n';
  return 0;
}
