#include <bits/stdc++.h>
using namespace std;
void preproc() {}
void reset() {}
void solve(int Tt) {
  int n;
  cin >> n;
  vector<long long> a(n);
  vector<long long> b(n);
  for (long long &x : a) cin >> x;
  for (long long &x : b) cin >> x;
  vector<long long> dp(n);
  auto Ix = [&](pair<long long, long long> l1,
                pair<long long, long long> l2) -> long double {
    return ((long double)l1.second - l2.second) / (l2.first - l1.first);
  };
  auto is_useless = [&](pair<long long, long long> l1,
                        pair<long long, long long> l2,
                        pair<long long, long long> l3) -> bool {
    return Ix(l1, l3) <= Ix(l1, l2);
  };
  vector<pair<long long, long long> > ch;
  dp[0] = 0;
  auto insert = [&](long long m, long long c) -> void {
    pair<long long, long long> l3 = make_pair(m, c);
    while ((int)ch.size() >= 2) {
      int sz = (int)ch.size();
      pair<long long, long long> l2 = ch[sz - 1];
      pair<long long, long long> l1 = ch[sz - 2];
      if (is_useless(l1, l2, l3)) {
        ch.pop_back();
      } else
        break;
    }
    ch.push_back(l3);
  };
  auto y = [&](int Lidx, int xi) -> long long {
    return (Lidx >= 0 and Lidx < (int)ch.size()
                ? ch[Lidx].second + a[xi] * ch[Lidx].first
                : LLONG_MAX);
  };
  auto find = [&](int xi) -> long long {
    long long mn = LLONG_MAX;
    int low = 0, high = (int)ch.size() - 2;
    if (low <= high) {
      while (low <= high) {
        int g = (low + high) / 2;
        if (y(g, xi) >= y(g + 1, xi))
          low = g + 1;
        else
          high = g - 1;
      }
      mn = min({mn, y(high, xi), y(high + 1, xi)});
    }
    mn = min(mn, y((int)ch.size() - 1, xi));
    return mn;
  };
  insert(b[0], dp[0]);
  for (int i = 1; i < n; ++i) {
    dp[i] = find(i);
    insert(b[i], dp[i]);
  }
  cout << dp[n - 1] << '\n';
  return;
}
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  cout.precision(10);
  cout << fixed;
  preproc();
  int tc = 1;
  for (int Tt = 1; Tt <= tc; ++Tt) {
    ;
    reset();
    solve(Tt);
  }
  return EXIT_SUCCESS;
}
