#include <bits/stdc++.h>
using namespace std;
vector<pair<long long, long long> > s;
int point = 0;
long long inter(pair<long long, long long> x, pair<long long, long long> y) {
  return (long long)(y.second - x.second) / (x.first - y.first);
}
long long evaluate(int idx, int x) {
  return (long long)s[idx].first * x + (long long)s[idx].second;
}
void add(pair<long long, long long> x) {
  while (s.size() >= 2 &&
         inter(x, s[s.size() - 2]) <= inter(s[s.size() - 2], s[s.size() - 1])) {
    s.pop_back();
  }
  s.push_back(x);
}
long long find(int x) {
  int i, j;
  for (i = 0, j = s.size() - 1; i < j;) {
    int mid = (i + j) / 2;
    if (evaluate(mid, x) > evaluate(mid + 1, x)) {
      i = mid + 1;
    } else {
      j = mid;
    }
  }
  return s[i].first * x + s[i].second;
}
int main(void) {
  int N;
  scanf("%d", &N);
  int A[N + 1], B[N + 1];
  long long dp[N + 1];
  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;
  add(make_pair(B[1], 0));
  for (int i = 2; i <= N; i++) {
    dp[i] = find(A[i]);
    add(make_pair(B[i], dp[i]));
  }
  printf("%lld\n", dp[N]);
  return 0;
}
