#include <bits/stdc++.h>
using namespace std;
const long long modo = 1000000007;
long long arr1[100005], arr2[100005];
long long dp[100005];
long long lines[100005];
int32_t main() {
  long long n, m;
  cin >> n;
  for (long long i = 1; i <= n; i++) cin >> arr1[i];
  for (long long i = 1; i <= n; i++) cin >> arr2[i];
  lines[0] = 1;
  long long l = 0, r = 1;
  dp[1] = 0;
  for (long long i = 2; i <= n; i++) {
    while (r - l > 1 &&
           (dp[lines[l + 1]] - dp[lines[l]]) <=
               arr1[i] * 1.0 * (arr2[lines[l]] - arr2[lines[l + 1]])) {
      l++;
    }
    dp[i] = dp[lines[l]] + arr2[lines[l]] * arr1[i];
    while (r - l > 1 && (dp[lines[r - 1]] - dp[lines[r - 2]]) * 1.0 *
                                (arr2[i] - arr2[lines[r - 1]]) <
                            (dp[i] - dp[lines[r - 1]]) * 1.0 *
                                (arr2[lines[r - 1]] - arr2[lines[r - 2]])) {
      r--;
    }
    lines[r] = i;
    r++;
  }
  cout << dp[n] << "\n";
}
