#include <bits/stdc++.h>
using namespace std;
const int maxn = 100000 + 100;
struct Vec {
  int x;
  long long y;
  Vec() { x = 0, y = 0; }
  Vec(int a, long long b) { x = a, y = b; }
} V[maxn];
int N, a[maxn], b[maxn];
long long f[maxn];
bool cmp1(Vec *i, Vec *j, int *t) {
  long long a = (*i).y - (*j).y, b = (*i).x - (*j).x;
  return a / b <= (*t);
}
bool cmp2(Vec *i, Vec *j, Vec *k) {
  long long a = (*j).y - (*i).y, b = (*j).x - (*i).x;
  long long aa = (*k).y - (*i).y, bb = (*k).x - (*i).x;
  long long c = a / b, cc = aa / bb;
  if (c != cc) return c > cc;
  a %= b, aa %= bb;
  return a * bb - b * aa > 0;
}
void work() {
  for (int i = (1), _n = (N); i <= _n; i++) scanf("%d", &a[i]);
  for (int i = (1), _n = (N); i <= _n; i++) scanf("%d", &b[i]);
  memset(f, 0, sizeof(f));
  int Head = 1, Tail = 1;
  V[Head] = Vec(-b[1], f[1]);
  for (int i = (2), _n = (N); i <= _n; i++) {
    for (; Head < Tail && cmp1(V + Head, V + Head + 1, a + i); Head++)
      ;
    f[i] = -(long long)V[Head].x * a[i] + V[Head].y;
    Vec nw = Vec(-b[i], f[i]);
    for (; Head < Tail && cmp2(V + Tail - 1, V + Tail, &nw); Tail--)
      ;
    V[++Tail] = nw;
  }
  cout << f[N] << endl;
}
int main() {
  for (; scanf("%d", &N) != EOF; work())
    ;
  return 0;
}
