#include <bits/stdc++.h>
using namespace std;
struct Line {
  long long a, b;
  Line() {}
  Line(long long a, long long b) : a(a), b(b) {}
  long long get(long long x) { return a * x + b; }
};
struct Convex {
  int size;
  Line *hull;
  Convex(int v) : size(0), hull(new Line[v]) {}
  void add(long long a, long long b) {
    hull[size++] = Line(a, b);
    while (size > 2 && (double)(hull[size - 1].b - hull[size - 2].b) *
                               (hull[size - 3].a - hull[size - 2].a) <
                           (double)(hull[size - 2].b - hull[size - 3].b) *
                               (hull[size - 2].a - hull[size - 1].a))
      hull[size - 2] = hull[size - 1], size--;
  }
  long long query(long long x) {
    int l = -1, r = size - 1, mid;
    while (r - l > 1) {
      mid = (l + r) / 2;
      if (hull[mid].get(x) < hull[mid + 1].get(x))
        r = mid;
      else
        l = mid;
    }
    return hull[r].get(x);
  }
};
int n, a[100001], b[100001];
long long dp[100001];
int main() {
  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]);
  Convex con(n);
  for (int i = 2; i <= n; i++) {
    con.add(b[i - 1], dp[i - 1]);
    dp[i] = con.query(a[i]);
  }
  printf("%I64d\n", dp[n]);
  return 0;
}
