#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
using namespace std;
using ll = long long;
using ld = long double;
using itn = int;
mt19937 gen(29);
const ld eps = 1e-10;
const ll MAXN = 1e5;
const ll INF = 1e9;
ll gcd(ll a, ll b) {
  a = abs(a);
  b = abs(b);
  while (b) {
    a %= b;
    swap(a, b);
  }
  return a;
}
void read() {}
void solve() {}
void print() {}
struct Point {
  ll x, y;
  void scan() { cin >> x >> y; }
  Point(ll X = 0, ll Y = 0) {
    x = X;
    y = Y;
  }
  ll operator*(Point &a) { return x * a.y - y * a.x; }
  bool operator==(Point &a) { return x == a.x && y == a.y; }
};
struct T {
  ll x;
  ll k, b;
  T(ll X, ll K, ll B) {
    x = X;
    k = K;
    b = B;
  }
};
deque<T> q;
ll get(ll n) {
  while (q.size() > 1) {
    T now = q[1];
    if (now.x <= n) {
      q.pop_front();
    } else {
      break;
    }
  }
  return q.front().k * n + q.front().b;
}
void push(ll k, ll b) {
  while (!q.empty()) {
    ll x = (b - q.back().b) / (q.back().k - k);
    if (x <= q.back().x) {
      q.pop_back();
    } else {
      break;
    }
  }
  T p = T((b - q.back().b) / (q.back().k - k), k, b);
  q.push_back(p);
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout << fixed << setprecision(20);
  itn n;
  cin >> n;
  vector<int> a(n), b(n);
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  for (int i = 0; i < n; i++) {
    cin >> b[i];
  }
  q.push_back(T(-INF, b[0], 0));
  for (int i = 1; i < n - 1; i++) {
    ll t = get(a[i]);
    push(b[i], t);
  }
  cout << get(a[n - 1]);
  return 0;
}
