#include <bits/stdc++.h>
using namespace std;
struct line {
  long long int y0;
  long long int m;
  line() {}
  line(long long int _y0, int _m) : y0(_y0), m(_m) {}
};
bool check(line a, line b, line c) {
  return (1.0 * (c.y0 - a.y0)) / (1.0 * (a.m - c.m)) <
         (1.0 * (b.y0 - a.y0)) / (1.0 * (a.m - b.m));
}
int nh, pos;
line H[100005];
void update(line l) {
  while (nh >= 2 && check(H[nh - 2], H[nh - 1], l)) {
    if (pos == nh - 1) --pos;
    --nh;
  }
  H[nh++] = l;
}
long long int eval(int id, int x) {
  return H[id].y0 + (long long int)H[id].m * x;
}
long long int query(int x) {
  while (pos + 1 < nh && eval(pos, x) > eval(pos + 1, x)) ++pos;
  return eval(pos, x);
}
int trees;
long long int height[100005], cost[100005];
long long int dp[100005];
int main() {
  int i, j;
  cin >> trees;
  for (i = 0; i < trees; i++) {
    cin >> height[i];
  }
  for (i = 0; i < trees; i++) {
    cin >> cost[i];
  }
  dp[0] = 0;
  nh = 0;
  pos = 0;
  for (i = 1; i < trees; i++) {
    update(line(dp[i - 1], cost[i - 1]));
    dp[i] = query(height[i]);
  }
  cout << dp[trees - 1];
  return 0;
}
