Problem: 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.

Solution (in CPP):

Solution:
#include <bits/stdc++.h>
using namespace std;
const int N = 4400 + 10, NN = N << 2, M = NN * 15, inf = 1145141;
int rd() {
  int x = 0, w = 1;
  char ch = 0;
  while (ch < '0' || ch > '9') {
    if (ch == '-') w = -1;
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9') {
    x = x * 10 + (ch ^ 48);
    ch = getchar();
  }
  return x * w;
}
int to[M], nt[M], c[M], w[M], hd[NN], tot = 1;
void adde(int x, int y, int z, int zz) {
  ++tot, to[tot] = y, nt[tot] = hd[x], c[tot] = z, w[tot] = zz, hd[x] = tot;
  ++tot, to[tot] = x, nt[tot] = hd[y], c[tot] = 0, w[tot] = -zz, hd[y] = tot;
}
int di[NN], a2, pr[NN], fw[NN], ps, pt, tt;
bool vs[NN];
void csfl() {
  queue<int> q;
  while (1) {
    memset(di, 0x3f3f3f, sizeof(int) * (tt + 1));
    fw[ps] = inf, fw[pt] = 0;
    di[ps] = 0, vs[ps] = 1, q.push(ps);
    while (!q.empty()) {
      int x = q.front();
      q.pop();
      for (int i = hd[x]; i; i = nt[i]) {
        int y = to[i];
        if (c[i] > 0 && di[y] > di[x] + w[i]) {
          di[y] = di[x] + w[i];
          pr[y] = i, fw[y] = min(fw[x], c[i]);
          if (!vs[y]) vs[y] = 1, q.push(y);
        }
      }
      vs[x] = 0;
    }
    if (!fw[pt]) return;
    a2 += di[pt] * fw[pt];
    int x = pt;
    while (x != ps) {
      int i = pr[x];
      c[i] -= fw[pt], c[i ^ 1] += fw[pt];
      x = to[i ^ 1];
    }
  }
}
int n, nn, s1[N], s2[N], cn[N];
long long a[N], b[N], a1 = -1, l, r, ti;
long long nps(int i, long long t) { return a[i] * t + b[i]; }
bool cmp1(int aa, int bb) {
  return b[aa] != b[bb] ? b[aa] < b[bb] : a[aa] > a[bb];
}
bool cmp2(int aa, int bb) { return nps(aa, ti) < nps(bb, ti); }
int main() {
  n = rd(), nn = n + n;
  for (int i = 1; i <= nn; ++i) a[i] = rd(), b[i] = rd();
  for (int i = 1; i <= nn; ++i) s1[i] = s2[i] = i;
  sort(s1 + 1, s1 + nn + 1, cmp1);
  l = 0, r = 1e9 + 10;
  while (l <= r) {
    ti = (l + r) >> 1;
    for (int i = 1; i <= nn; ++i) cn[i] = 0;
    for (int i = 1, j = 0; i <= nn; ++i) {
      int x = s1[i];
      if (!j || nps(x, ti) > nps(j, ti)) j = x;
      if (x <= n) ++cn[j];
    }
    sort(s2 + 1, s2 + nn + 1, cmp2);
    int nw = 0;
    for (int i = nn, j = nn; i; --j, i = j) {
      while (j > 1 && nps(s2[i], ti) == nps(s2[j - 1], ti)) --j;
      for (int k = i; k >= j; --k) nw += cn[s2[k]];
      for (int k = i; k >= j; --k) nw -= s2[k] > n;
      if (nw < 0) break;
    }
    if (nw >= 0)
      a1 = ti, r = ti - 1;
    else
      l = ti + 1;
  }
  if (a1 == -1) {
    printf("%lld\n", a1);
    return 0;
  }
  ps = 0, tt = pt = nn + nn + 2;
  for (int i = 1; i <= nn; ++i) {
    if (i <= n)
      adde(ps, i, 1, 0);
    else
      adde(i + nn, pt, 1, 0);
    adde(i, i + nn, inf, 0);
  }
  ti = a1, sort(s2 + 1, s2 + nn + 1, cmp2);
  for (int i = 1, j = 1, lp = ++tt; i <= nn; ++j, i = j) {
    while (j < nn && b[s1[i]] == b[s1[j + 1]]) ++j;
    int np = ++tt;
    for (int k = i; k <= j; ++k) adde(s1[k], np, inf, 1);
    for (int k = i; k <= j; ++k) adde(np, s1[k], inf, 0);
    adde(np, lp, inf, 0), lp = np;
  }
  for (int i = 1, j = 1, lp = ++tt; i <= nn; ++j, i = j) {
    while (j < nn && nps(s2[i], ti) == nps(s2[j + 1], ti)) ++j;
    int np = ++tt;
    for (int k = i; k <= j; ++k) adde(s2[k] + nn, np, inf, 1);
    for (int k = i; k <= j; ++k) adde(np, s2[k] + nn, inf, 0);
    adde(np, lp, inf, 0), lp = np;
  }
  csfl();
  printf("%lld %d\n", a1, a2);
  return 0;
}