Warning: This problem has an unusual memory limit!

Bob decided that he will not waste his prime years implementing GUI forms for a large corporation and instead will earn his supper on the Stock Exchange Reykjavik. The Stock Exchange Reykjavik is the only actual stock exchange in the world. The only type of transaction is to take a single share of stock x and exchange it for a single share of stock y, provided that the current price of share x is at least the current price of share y. 

There are 2n stocks listed on the SER that are of interest to Bob, numbered from 1 to 2n. Bob owns a single share of stocks 1 through n and would like to own a single share of each of n+1 through 2n some time in the future.

Bob managed to forecast the price of each stock — in time t ≥ 0, the stock i will cost a_i ⋅ ⌊ t ⌋ + b_i. The time is currently t = 0. Help Bob find the earliest moment in time in which he can own a single share of each of n+1 through 2n, and the minimum number of stock exchanges he has to perform in order to do that.

You may assume that the Stock Exchange has an unlimited amount of each stock at any point in time. 

Input

The first line contains a single integer n (1 ≤ n ≤ 2200) — the number stocks currently owned by Bob.

Each of the next 2n lines contains integers a_i and b_i (0 ≤ a_i, b_i ≤ 10^9), representing the stock price of stock i. 

Output

If it is impossible for Bob to achieve his goal, output a single integer -1.

Otherwise, output two integers T and E, where T is the minimum time in which he can achieve his goal, and E is the minimum number of exchanges in which he can achieve his goal at time T.

Examples

Input


1
3 10
1 16


Output


3 1


Input


2
3 0
2 1
1 10
1 11


Output


6 3


Input


1
42 42
47 47


Output


-1


Input


8
145 1729363
891 4194243
424 853731
869 1883440
843 556108
760 1538373
270 762781
986 2589382
610 99315884
591 95147193
687 99248788
65 95114537
481 99071279
293 98888998
83 99764577
769 96951171


Output


434847 11


Input


8
261 261639
92 123277
271 131614
320 154417
97 258799
246 17926
117 222490
110 39356
85 62864876
86 62781907
165 62761166
252 62828168
258 62794649
125 62817698
182 62651225
16 62856001


Output


1010327 11

Note

In the first example, Bob simply waits until time t = 3, when both stocks cost exactly the same amount.

In the second example, the optimum strategy is to exchange stock 2 for stock 1 at time t = 1, then exchange one share of stock 1 for stock 3 at time t = 5 (where both cost 15) and then at time t = 6 exchange the second on for the stock number 4 (when they cost 18 and 17, respectively). Note that he can achieve his goal also with only two exchanges, but this would take total time of t = 9, when he would finally be able to exchange the share number 2 for the share number 3. 

In the third example, Bob can never achieve his goal, as the second stock is always strictly more expensive than the first one.
#include <bits/stdc++.h>
using namespace std;
inline char gc() {
  static char buf[100000], *p1 = buf, *p2 = buf;
  return p1 == p2 && (p2 = (p1 = buf) + fread(buf, 1, 100000, stdin), p1 == p2)
             ? EOF
             : *p1++;
}
inline long long read() {
  long long x = 0;
  char ch = getchar();
  bool positive = 1;
  for (; !isdigit(ch); ch = getchar())
    if (ch == '-') positive = 0;
  for (; isdigit(ch); ch = getchar()) x = x * 10 + ch - '0';
  return positive ? x : -x;
}
inline void write(long long a) {
  if (a < 0) {
    a = -a;
    putchar('-');
  }
  if (a >= 10) write(a / 10);
  putchar('0' + a % 10);
}
inline void writeln(long long a) {
  write(a);
  puts("");
}
inline void wri(long long a) {
  write(a);
  putchar(' ');
}
inline unsigned long long rnd() {
  return ((unsigned long long)rand() << 30 ^ rand()) << 4 | rand() % 4;
}
const int inf = 1e9;
const int N = 10000, M = 400005;
int n, q[N], nedge = 1, son[N], nextt[M], ed[M];
int cost[M], dist[N], di[M];
bool vis[N];
int last[N], que[N], laedge[N];
int a[4405], b[4405];
long long g[N], f[N], jb[N], jj[N];
bool spfa(int s, int t, int n) {
  for (int i = 1; i <= n; i++) {
    dist[i] = inf;
    last[i] = laedge[i] = vis[i] = que[i - 1] = 0;
  }
  int tot = 1, l = 0, r = 0;
  que[0] = s;
  vis[s] = true;
  dist[s] = 0;
  while (tot) {
    int k = que[l];
    vis[k] = false;
    if (++l == n) l = 0;
    tot--;
    for (int i = son[k]; i; i = nextt[i]) {
      if (di[i] > 0 && dist[ed[i]] > dist[k] + cost[i]) {
        dist[ed[i]] = dist[k] + cost[i];
        laedge[ed[i]] = i;
        last[ed[i]] = k;
        if (vis[ed[i]] == 0) {
          if (++r == n) r = 0;
          que[r] = ed[i];
          tot++;
          vis[ed[i]] = true;
        }
      }
    }
  }
  return last[t] > 0;
}
int costflow(int s, int t, int n) {
  int sum = 0, cost = 0;
  while (spfa(s, t, n)) {
    int mmin = inf;
    for (int i = t; last[i]; i = last[i]) {
      mmin = min(mmin, di[laedge[i]]);
    }
    sum += mmin;
    cost += dist[t] * mmin;
    for (int i = t; last[i]; i = last[i]) {
      di[laedge[i]] -= mmin;
      di[laedge[i] ^ 1] += mmin;
    }
  }
  return cost;
}
inline void aedge(int a, int b, int c, int d) {
  nextt[++nedge] = son[a];
  son[a] = nedge;
  ed[nedge] = b;
  di[nedge] = c;
  cost[nedge] = d;
}
inline void ins(int a, int b, int c, int d) {
  aedge(a, b, c, d);
  aedge(b, a, 0, -d);
}
bool cmp(int x, int y) {
  return make_pair(b[x], -a[x]) < make_pair(b[y], -a[y]);
}
bool cmg(int x, int y) { return g[x] < g[y]; }
bool check(long long x) {
  long long mx = 0;
  *jb = *jj = 0;
  for (int i = (int)(1); i <= (int)(n * 2); i++) {
    mx = max(mx, x * a[q[i]] + b[q[i]]);
    if (q[i] <= n) {
      jb[++*jb] = mx;
    } else
      jj[++*jj] = x * a[q[i]] + b[q[i]];
  }
  sort(jj + 1, jj + n + 1);
  for (int i = (int)(1); i <= (int)(n); i++)
    if (jb[i] < jj[i]) return 0;
  return 1;
}
void solve(long long x) {
  int s = 4 * n + 1, t = s + 1;
  long long mx = 0;
  for (int i = (int)(1); i <= (int)(n * 2); i++) {
    mx = max(mx, x * a[q[i]] + b[q[i]]);
    if (q[i] <= n) {
      f[q[i]] = mx;
    }
  }
  for (int i = (int)(n + 1); i <= (int)(2 * n); i++) g[q[i] = i] = b[i];
  sort(q + n + 1, q + 2 * n + 1, cmg);
  for (int i = (int)(n + 1); i <= (int)(2 * n); i++) {
    ins(q[i] + n, q[i], 1, 0);
    if (i > n + 1) ins(q[i] + n, q[i - 1] + n, inf, 0);
    ins(i, t, 1, 0);
  }
  for (int i = (int)(1); i <= (int)(n); i++) {
    for (int j = (int)(2 * n); j >= (int)(n + 1); j--)
      if (g[q[j]] <= b[i]) {
        ins(i, q[j] + n, 1, 0);
        break;
      }
    ins(s, i, 1, 0);
  }
  for (int i = (int)(n + 1); i <= (int)(2 * n); i++)
    g[q[i] = i] = a[i] * x + b[i];
  sort(q + n + 1, q + 2 * n + 1, cmg);
  for (int i = (int)(n + 1); i <= (int)(2 * n); i++) {
    ins(q[i] + 2 * n, q[i], 1, 0);
    if (i > n + 1) ins(q[i] + 2 * n, q[i - 1] + 2 * n, inf, 0);
  }
  for (int i = (int)(1); i <= (int)(n); i++) {
    for (int j = (int)(2 * n); j >= (int)(n + 1); j--)
      if (g[q[j]] <= f[i]) {
        ins(i, q[j] + 2 * n, 1, 1);
        break;
      }
    for (int j = (int)(2 * n); j >= (int)(n + 1); j--)
      if (g[q[j]] <= x * a[i] + b[i]) {
        ins(i, q[j] + 2 * n, 1, 0);
        break;
      }
  }
  writeln(costflow(s, t, t) + n);
}
int main() {
  n = read();
  for (int i = (int)(1); i <= (int)(n * 2); i++) {
    a[i] = read();
    b[i] = read();
    q[i] = i;
  }
  sort(&q[1], &q[2 * n + 1], cmp);
  int l = 0, r = inf + 1;
  while (l < r) {
    int mid = (l + r) >> 1;
    if (check(mid))
      r = mid;
    else
      l = mid + 1;
  }
  if (r > inf)
    puts("-1");
  else {
    wri(l);
    solve(l);
  }
}
