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;
struct data {
  int a, b;
  bool is;
  inline bool operator<(const data& x) const {
    return b ^ x.b ? b < x.b : a > x.a;
  }
} a[30800];
struct data1 {
  long long x;
  int y;
  inline bool operator<(const data1& a) const { return x < a.x; }
} a3[30800], a4[30800];
struct point {
  int next, to, w, w1;
} ar[30800];
bool is[30800];
long long a1[30800], a2[30800];
int T[3][30800];
int n, n1, a1t, a2t, tot, head[30800], art(1);
int a3t, a4t, ps, pt, fee, dis[30800], pre[30800];
inline bool check(int), bfs();
inline void read(int&), link(int, int, int, int);
int main() {
  read(n), tot = n1 = n << 1;
  for (int i(1); i <= n1; ++i) read(a[i].a), read(a[i].b), a[i].is = i <= n;
  sort(a + 1, a + n1 + 1);
  int l(0), mid, r(0x3f3f3f3f);
  while (mid = l + r >> 1, l < r) check(mid) ? r = mid : l = mid + 1;
  if (l == 0x3f3f3f3f) return puts("-1"), 0;
  for (int i(1); i <= n1; ++i)
    if (a[i].is) {
      if (tot > n1) link(i, tot, 1, 1);
    } else {
      link(++tot, i, 0x3f3f3f3f, 0);
      if (tot > n1 + 1) link(tot, tot - 1, 0x3f3f3f3f, 0);
    }
  for (int i(1); i <= n1; ++i) {
    long long j((long long)a[i].a * l + a[i].b);
    a1[i] = max(a1[i - 1], j);
    if (!a[i].is) a3[++a3t] = {j, ++tot}, link(tot, i, 0x3f3f3f3f, 0);
  }
  sort(a3 + 1, a3 + a3t + 1);
  for (int i(2); i <= n; ++i) link(a3[i].y, a3[i - 1].y, 0x3f3f3f3f, 0);
  for (int i(1), j(1); i <= n1; ++i)
    if (a[i].is) {
      while (j <= n && a3[j].x <= a1[i]) ++j;
      if (j > 1) link(i, a3[j - 1].y, 1, 2);
      a4[++a4t] = {(long long)l * a[i].a + a[i].b, i};
    }
  sort(a4 + 1, a4 + n + 1);
  for (int i(1), j(1); i <= n; ++i) {
    while (j <= n && a3[j].x <= a4[i].x) ++j;
    if (j > 1) link(a4[i].y, a3[j - 1].y, 1, 1);
  }
  ps = ++tot, pt = ++tot, memset(a1, 0, sizeof(a1));
  for (int i(1); i <= n1; ++i) a[i].is ? link(ps, i, 1, 0) : link(i, pt, 1, 0);
  while (bfs())
    ;
  return printf("%d %d", l, fee), 0;
}
template <class free>
struct heap {
  free a[30800];
  int n;
  inline void push(free x) {
    a[++n] = x;
    register int p(n);
    while (p > 1)
      if (a[p] < a[p >> 1])
        swap(a[p], a[p >> 1]), p >>= 1;
      else
        break;
  }
  inline void pop() {
    a[1] = a[n--];
    register int p(1), s(2);
    while (s <= n) {
      if (s < n && a[s | 1] < a[s]) s |= 1;
      if (a[s] < a[p])
        swap(a[s], a[p]), p = s, s <<= 1;
      else
        break;
    }
  }
};
struct pi {
  long long x;
  int y;
  inline bool operator<(const pi& a) const { return x < a.x; }
};
heap<pi> H;
inline bool bfs() {
  memset(dis, 0x3f, tot + 1 << 2);
  memset(is, 0, tot + 1), H.push({dis[ps] = 0, ps});
  while (H.n) {
    pi s(H.a[1]);
    if (H.pop(), is[s.y]) continue;
    is[s.y] = 1;
    for (int i(head[s.y]); i; i = ar[i].next)
      if (ar[i].w && !is[ar[i].to]) {
        if (ar[i].w1 + a1[s.y] - a1[ar[i].to] < 0) throw;
        long long j(s.x + ar[i].w1 + a1[s.y] - a1[ar[i].to]);
        if (j < dis[ar[i].to])
          H.push({dis[ar[i].to] = j, ar[i].to}), pre[ar[i].to] = i;
      }
  }
  if (!is[pt]) return false;
  int p(pt);
  fee += (dis[pt] - a1[ps] + a1[pt]);
  while (pre[p])
    ar[pre[p]].w -= 1, ar[pre[p] ^ 1].w += 1, p = ar[pre[p] ^ 1].to;
  for (int i(1); i <= tot; ++i) a1[i] += dis[i];
  return true;
}
inline void link(int u, int v, int w, int w1) {
  ar[++art] = {head[u], v, w, w1}, head[u] = art;
  ar[++art] = {head[v], u, 0, -w1}, head[v] = art;
}
inline bool check(int mid) {
  a1t = a2t = 0;
  long long temp(0);
  for (int i(1); i <= n1; ++i) {
    long long j((long long)a[i].a * mid + a[i].b);
    temp = max(temp, j);
    a[i].is ? a1[++a1t] = temp : a2[++a2t] = j;
  }
  sort(a2 + 1, a2 + n + 1);
  for (int i(1); i <= n; ++i)
    if (a1[i] < a2[i]) return false;
  return true;
}
inline void read(int& x) {
  x ^= x;
  register char c;
  while (c = getchar(), c < '0' || c > '9')
    ;
  while (c >= '0' && c <= '9')
    x = (x << 1) + (x << 3) + (c ^ 48), c = getchar();
}