#include <bits/stdc++.h>
using namespace std;
struct P {
  long long x, y;
  long double k;
  P() {}
  P(long long a, long long b) : x(a), y(b) {
    k = (long double)y / (long double)x;
  }
  P operator-(const P &a) const { return P(x - a.x, y - a.y); }
};
P q[100000 + 5];
int a[100000 + 5], b[100000 + 5];
long long dp[100000 + 5];
int main() {
  int n;
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) scanf("%d", &a[i]);
  for (int i = 1; i <= n; i++) scanf("%d", &b[i]);
  int front = 0, rear = -1;
  dp[1] = 0;
  q[++rear] = P(-b[1], dp[1]);
  for (int i = 2; i <= n; i++) {
    while (front < rear &&
           (q[front + 1] - q[front]).y <= (q[front + 1] - q[front]).x * a[i])
      front++;
    dp[i] = q[front].y - q[front].x * a[i];
    P tmp(-b[i], dp[i]);
    while (front < rear && (q[rear] - q[rear - 1]).k >= (tmp - q[rear - 1]).k)
      rear--;
    q[++rear] = tmp;
  }
  printf("%I64d\n", dp[n]);
  return 0;
}
