#include <bits/stdc++.h>
using namespace std;
const long double Fictive = 5e18;
struct str {
  long long k, b;
  long double eval(long double x) { return x * (long double)k + b; }
};
vector<str> vec;
inline long double get_x(str fi, str se) {
  return (long double)(fi.b - se.b) / (long double)(se.k - fi.k);
}
inline bool to_erase(str l1, str l2, str l3) {
  long double x = get_x(l1, l3);
  return (l2.eval(x) >= l3.eval(x));
}
inline void add_line(str l) {
  while (vec.size() >= 2 && to_erase(vec[vec.size() - 2], vec.back(), l))
    vec.pop_back();
  vec.push_back(l);
}
inline long long get(long long x) {
  int l = 0, r = vec.size() - 1;
  while (l < r) {
    int mid = (l + r) >> 1;
    if (vec[mid].eval(x) >= vec[mid + 1].eval(x))
      l = mid + 1;
    else
      r = mid;
  }
  return vec[l].eval(x);
}
int n, a[100100], b[100100];
long long dp[100100];
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin >> n;
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
  }
  for (int i = 1; i <= n; i++) {
    cin >> b[i];
  }
  dp[1] = 0;
  add_line({b[1], 0});
  for (int i = 2; i <= n; i++) {
    dp[i] = 1e15;
    dp[i] = get(a[i]);
    add_line({b[i], dp[i]});
  }
  cout << dp[n];
}
