#include <bits/stdc++.h>
using namespace std;
int AA[100010];
int BB[100010];
long long dp[100010];
int N;
vector<long long> M;
vector<long long> B;
bool bad(long long l1, long long l2, long long l3) {
  long double XX1 = 1.00000 * (M[l1] - M[l2]) / (M[l1] - M[l3]);
  long double XX2 = 1.00000 * (B[l2] - B[l1]) / (B[l3] - B[l1]);
  return XX1 < XX2;
}
void add(long long m, long long b) {
  M.push_back(m);
  B.push_back(b);
  while (M.size() >= 3 && bad(M.size() - 3, M.size() - 2, M.size() - 1)) {
    M.erase(M.end() - 2);
    B.erase(B.end() - 2);
  }
}
int pointer;
long long query(long long x) {
  if (pointer >= M.size()) pointer = M.size() - 1;
  while (pointer < M.size() - 1 &&
         M[pointer + 1] * x + B[pointer + 1] > M[pointer] * x + B[pointer])
    pointer++;
  return M[pointer] * x + B[pointer];
}
int main() {
  ios_base::sync_with_stdio(0);
  cin >> N;
  for (int i = 1; i <= N; i++) {
    cin >> AA[i];
  }
  for (int i = 1; i <= N; i++) {
    cin >> BB[i];
  }
  dp[1] = 0LL;
  add(-BB[1], -dp[1]);
  for (int i = 2; i <= N; i++) {
    dp[i] = -1LL * query(AA[i]);
    add(-BB[i], -dp[i]);
  }
  cout << dp[N] << endl;
  return 0;
}
