#include <bits/stdc++.h>
using namespace std;
const long long int M = 2e5 + 7;
const long long int mod = 1e9 + 7;
const long long int infi = LLONG_MAX;
long long int i, j, ans, k, n, mymax = LLONG_MIN, mymin = LLONG_MAX, c, z, sum;
long long int a[M], b[M];
long long int dp[M];
deque<pair<long long int, long long int> > lines;
void new_entry(long long int c3, long long int m3) {
  long long int c2, c1, m2, m1;
  while (lines.size() > 1) {
    c2 = lines[0].first;
    m2 = lines[0].second;
    m1 = lines[1].second;
    c1 = lines[1].first;
    if ((long double)(c1 - c2) * (long double)(m3 - m1) >
        ((long double)(c1 - c3) * (long double)(m2 - m1))) {
      lines.pop_front();
    } else
      break;
  }
  lines.push_front({c3, m3});
}
long long int cal(long long int index, long long int x) {
  return (lines[index].second * x + lines[index].first);
}
void cal_dp(long long int x, long long int index) {
  long long int cap = lines.size();
  while (cap >= 2) {
    if (cal(cap - 1, x) > cal(cap - 2, x)) {
      lines.pop_back();
    } else {
      break;
    }
    cap = lines.size();
  }
  new_entry(cal(cap - 1, x), b[index]);
}
int main() {
  scanf("%lld", &n);
  for (i = 0; i < n; i++) scanf("%lld", &a[i]);
  for (i = 0; i < n; i++) scanf("%lld", &b[i]);
  lines.push_front({0, b[0]});
  for (i = 1; i < n; i++) {
    cal_dp(a[i], i);
  }
  printf("%lld\n", lines[0].first);
  return 0;
}
