#include <bits/stdc++.h>
using namespace std;
const int maxc = 100005;
const int maxsize = 300;
const int maxn = 1e5 + 20;
const unsigned long long inf = 1e18;
const unsigned long long mod = 1e10;
const unsigned long long maxv = mod;
struct line {
  unsigned long long k, b;
  line() {}
  line(unsigned long long new_k, unsigned long long new_b) {
    k = new_k;
    b = new_b;
  }
  unsigned long long get(unsigned long long x) { return k * x + b; }
};
const line lbad = line(0, inf);
struct node {
  node* left;
  node* right;
  line l;
  node() {
    l = lbad;
    left = nullptr;
    right = nullptr;
  }
  node(line l_new) {
    l = l_new;
    left = nullptr;
    right = nullptr;
  }
};
void add(node*& v, line l, unsigned long long lcur, unsigned long long rcur) {
  unsigned long long m = (lcur + rcur) / 2;
  if (v->l.get(m) > l.get(m)) swap(v->l, l);
  if (v->l.get(lcur) > l.get(lcur)) {
    if (!v->left) v->left = new node();
    add(v->left, l, lcur, m);
  } else if (v->l.get(rcur) > l.get(rcur)) {
    if (!v->right) v->right = new node();
    add(v->right, l, m, rcur);
  }
}
unsigned long long ans(node* v, unsigned long long x, unsigned long long lcur,
                       unsigned long long rcur) {
  if (!v) return inf;
  unsigned long long res = v->l.get(x);
  if (rcur == lcur + 1) return res;
  unsigned long long m = (lcur + rcur) / 2;
  if (x < m) {
    return min(res, ans(v->left, x, lcur, m));
  } else {
    return min(res, ans(v->right, x, m, rcur));
  }
}
unsigned long long dp[maxn];
unsigned long long a[maxn];
unsigned long long b[maxn];
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  node* root = new node();
  int n;
  cin >> n;
  for (int i = 0; i < n; i++) cin >> a[i];
  for (int i = 0; i < n; i++) cin >> b[i];
  dp[0] = 0;
  add(root, line(b[0], 0), 0, maxv);
  for (int i = 1; i < n; i++) {
    dp[i] = ans(root, a[i], 0, maxv);
    add(root, line(b[i], dp[i]), 0, maxv);
  }
  cout << dp[n - 1] << endl;
  return 0;
}
