#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
using namespace std;
struct line {
  long long m, c;
  long long eval(long long x) { return m * x + c; }
  long long div(long long a, long long b) {
    return a / b - ((a ^ b) < 0 && a % b);
  }
  long long intersectX(line l) { return div(c - l.c, l.m - m); }
};
struct LineContainerFast {
  vector<line> v;
  int start, end;
  LineContainerFast() {
    start = 0;
    end = -1;
  }
  void add(long long m, long long c) {
    line l = {m, c};
    while (start < end && l.intersectX(v[end]) <= v[end].intersectX(v[end - 1]))
      --end;
    if (++end == v.size())
      v.push_back(l);
    else
      v[end] = l;
  }
  long long query(long long x) {
    assert(start <= end);
    while (start < end && v[start].eval(x) >= v[start + 1].eval(x)) ++start;
    return v[start].eval(x);
  }
};
void solve() {
  int n;
  cin >> n;
  long long a[n], b[n];
  for (int i = 0; i < n; i++) cin >> a[i];
  for (int i = 0; i < n; i++) cin >> b[i];
  LineContainerFast l;
  long long dp[n];
  dp[0] = 0;
  l.add(b[0], dp[0]);
  for (int i = 1; i < n; i++) {
    dp[i] = l.query(a[i]);
    l.add(b[i], dp[i]);
  }
  cout << dp[n - 1] << "\n";
}
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  solve();
}
