#include <bits/stdc++.h>
using namespace std;
int setBit(int n, int pos) { return n = n | (1 << pos); }
int resetBit(int n, int pos) { return n = n & ~(1 << pos); }
bool checkBit(long long n, long long pos) { return (bool)(n & (1LL << pos)); }
const int MAX = 100010;
struct CHT {
  long long M[MAX], C[MAX];
  int len, cur;
  void init() { len = 0, cur = 0; }
  inline bool isBad(long long nm, long long nc) {
    return ((C[len - 1] - C[len - 2]) / (double)(M[len - 2] - M[len - 1]) >=
            (nc - C[len - 2]) / (double)(M[len - 2] - nm));
  }
  inline void addLine(long long nm, long long nc) {
    if (len == 0)
      M[len] = nm, C[len] = nc, len++;
    else if (M[len - 1] == nm) {
      if (C[len - 1] < nc)
        return;
      else
        C[len - 1] = nc;
    } else {
      while (len >= 2) {
        if (isBad(nm, nc))
          len--;
        else
          break;
      }
      M[len] = nm, C[len] = nc, len++;
    }
  }
  inline long long getY(int id, long long x) { return (M[id] * x + C[id]); }
  inline long long query(long long x) {
    int lo = -1, hi = len - 1;
    while (hi - lo > 1) {
      int mid = (hi + lo) >> 1;
      if (getY(mid, x) < getY(mid + 1, x))
        hi = mid;
      else
        lo = mid;
    }
    return getY(lo + 1, x);
  }
};
int a[MAX], b[MAX];
long long dp[MAX];
int main() {
  CHT c;
  c.init();
  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]);
  dp[1] = 0;
  c.addLine(b[1], dp[1]);
  for (int i = 2; i <= n; i++) {
    dp[i] = c.query(a[i]);
    c.addLine(b[i], dp[i]);
  }
  printf("%lld\n", dp[n]);
  return 0;
}
