#include <bits/stdc++.h>
using namespace std;
long long MOD = 1000000007;
long double EPS = 1e-9;
template <class second, class T>
ostream& operator<<(ostream& os, const pair<second, T>& p) {
  return os << "(" << p.first << ", " << p.second << ")";
}
template <class T>
ostream& operator<<(ostream& os, const vector<T>& p) {
  os << "[ ";
  for (auto& it : p) os << it << " ";
  return os << "]";
}
template <class T>
ostream& operator<<(ostream& os, const unordered_set<T>& p) {
  os << "[ ";
  for (auto& it : p) os << it << " ";
  return os << "]";
}
template <class second, class T>
ostream& operator<<(ostream& os, const unordered_map<second, T>& p) {
  os << "[ ";
  for (auto& it : p) os << it << " ";
  return os << "]";
}
template <class T>
ostream& operator<<(ostream& os, const set<T>& p) {
  os << "[ ";
  for (auto& it : p) os << it << " ";
  return os << "]";
}
template <class T>
ostream& operator<<(ostream& os, const multiset<T>& p) {
  os << "[ ";
  for (auto& it : p) os << it << " ";
  return os << "]";
}
template <class second, class T>
ostream& operator<<(ostream& os, const map<second, T>& p) {
  os << "[ ";
  for (auto& it : p) os << it << " ";
  return os << "]";
}
template <class T>
void dbs(string str, T t) {
  cerr << str << " : " << t << "\n";
}
template <class T, class... second>
void dbs(string str, T t, second... s) {
  int idx = str.find(',');
  cerr << str.substr(0, idx) << " : " << t << ",";
  dbs(str.substr(idx + 1), s...);
}
template <class T>
void prc(T a, T b) {
  cerr << "[";
  for (T i = a; i != b; ++i) {
    if (i != a) cerr << ", ";
    cerr << *i;
  }
  cerr << "]\n";
}
long long binpow(long long b, long long p, long long mod) {
  long long ans = 1;
  b %= mod;
  for (; p; p >>= 1) {
    if (p & 1) ans = ans * b % mod;
    b = b * b % mod;
  }
  return ans;
}
void pre() {}
const long long is_query = -(1LL << 62);
struct convex_line {
  long long m, b;
  mutable function<const convex_line*()> succ;
  bool operator<(const convex_line& rhs) const {
    if (rhs.b != is_query) return m < rhs.m;
    const convex_line* s = succ();
    if (s == NULL) return 0;
    long long x = rhs.m;
    return 1.0 * (b - s->b) < 1.0 * (s->m - m) * x;
  }
};
struct dcht : public multiset<convex_line> {
  bool invalid(iterator y) {
    auto z = next(y);
    if (y == begin()) {
      if (z == end()) return 0;
      return y->m == z->m && y->b <= z->b;
    }
    auto x = prev(y);
    if (z == end()) return y->m == x->m && y->b <= x->b;
    return 1.0 * (x->b - y->b) * (z->m - y->m) >=
           1.0 * (y->b - z->b) * (y->m - x->m);
  }
  void insert_line(long long m, long long b) {
    auto y = insert({m, b});
    y->succ = [=] { return next(y) == end() ? 0 : &*next(y); };
    if (invalid(y)) {
      erase(y);
      return;
    }
    while (next(y) != end() && invalid(next(y))) erase(next(y));
    while (y != begin() && invalid(prev(y))) erase(prev(y));
  }
  void remove_line(long long m, long long b) {
    auto y = find({m, b});
    if (y == end()) return;
    erase(y);
  }
  long long eval(long long x) {
    auto l = lower_bound({x, is_query});
    return (*l).m * x + (*l).b;
  }
};
void solve() {
  long long n;
  cin >> n;
  long long arr[n], brr[n], dp[n];
  for (long long i = 0; i < n; ++i) cin >> arr[i];
  for (long long i = 0; i < n; ++i) cin >> brr[i];
  dp[0] = 0;
  dcht dd;
  for (long long i = 1; i <= n - 1; ++i) {
    dd.insert_line(-brr[i - 1], -dp[i - 1]);
    dp[i] = -dd.eval(arr[i]);
  }
  cout << dp[n - 1] << '\n';
}
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  pre();
  long long t = 1;
  for (long long i = 1; i <= t; i++) {
    solve();
  }
}
