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 node {
  long long x, y;
  int id;
} h[5010];
pair<long long, long long> num[5010], h1[5010];
int cnt[5010], n;
inline int rd() {
  int x = 0;
  char ch = getchar();
  for (; ch < '0' || ch > '9'; ch = getchar())
    ;
  for (; ch >= '0' && ch <= '9'; ch = getchar()) x = x * 10 + ch - '0';
  return x;
}
inline bool cmp(const node &x, const node &y) {
  return (x.x ^ y.x) ? (x.x < y.x) : (x.y > y.y);
}
inline bool check(int mid) {
  for (int i = 1; i <= n * 2; i++)
    h[i].x = num[i].second, h[i].y = num[i].first * mid + num[i].second,
    h[i].id = i;
  for (int i = 1; i <= n * 2; i++)
    h1[i] = pair<long long, long long>(h[i].y, i);
  sort(h + 1, h + n * 2 + 1, cmp);
  sort(h1 + 1, h1 + n * 2 + 1);
  memset(cnt, 0, sizeof(cnt));
  long long mx = -2333333333333333333LL;
  for (int i = 1; i <= n * 2; i++) {
    mx = max(mx, h[i].y);
    if (h[i].id <= n)
      cnt[upper_bound(h1 + 1, h1 + n * 2 + 1,
                      pair<long long, long long>(mx, 2333333333333333333LL)) -
          h1]++;
  }
  int now = 0;
  for (int i = 1; i <= n * 2; i++) {
    now -= cnt[i];
    if (now < 0) return false;
    if (h1[i].second > n) now++;
  }
  return true;
}
namespace Gao {
struct node {
  int t, v, c, op, next;
} a[200010];
int head[14010], dis[14010], cur[14010], vs, vt, tot;
bool vis[14010], inq[14010];
inline void add(int x, int y, int z, int c) {
  a[++tot].t = y;
  a[tot].v = z;
  a[tot].c = c;
  a[tot].op = tot + 1;
  a[tot].next = head[x];
  head[x] = tot;
  a[++tot].t = x;
  a[tot].v = 0;
  a[tot].c = -c;
  a[tot].op = tot - 1;
  a[tot].next = head[y];
  head[y] = tot;
}
int ans, cost;
queue<int> q;
inline bool spfa() {
  while (!q.empty()) q.pop();
  for (int i = vs; i <= vt; i++) dis[i] = 1061109567, inq[i] = false;
  dis[vt] = 0;
  q.push(vt);
  inq[vt] = true;
  while (!q.empty()) {
    int x = q.front();
    q.pop();
    for (int i = head[x]; i; i = a[i].next)
      if (a[a[i].op].v) {
        int t = a[i].t;
        if (dis[t] > dis[x] - a[i].c) {
          dis[t] = dis[x] - a[i].c;
          if (!inq[t]) inq[t] = true, q.push(t);
        }
      }
    inq[x] = false;
  }
  return dis[vs] < 1061109567;
}
inline int dfs(int x, int y) {
  if (x == vt || !y) return y;
  vis[x] = true;
  int res = 0;
  for (int &i = cur[x]; i; i = a[i].next)
    if (a[i].v) {
      int t = a[i].t;
      if (dis[t] != dis[x] - a[i].c || vis[t]) continue;
      int hh = dfs(t, min(y, a[i].v));
      if (!hh) continue;
      res += hh;
      y -= hh;
      a[i].v -= hh;
      a[a[i].op].v += hh;
      cost += a[i].c * hh;
      if (!y) break;
    }
  vis[x] = false;
  return res;
}
inline int work(int mid) {
  vs = 0;
  vt = n * 6 + 1;
  for (int i = 1; i <= n; i++) add(vs, i, 1, 0);
  for (int i = 1; i <= n; i++) add(n + i, vt, 1, 0);
  for (int i = 1; i <= n * 2; i++)
    h1[i] = pair<long long, long long>(num[i].second, i);
  sort(h1 + 1, h1 + n * 2 + 1);
  for (int i = 1; i <= n * 2; i++) add(n * 2 + i, h1[i].second, 1061109567, 0);
  for (int i = 2; i <= n * 2; i++) add(n * 2 + i, n * 2 + i - 1, 1061109567, 0);
  for (int i = 1; i <= n * 2; i++)
    if (h1[i].second <= n)
      add(h1[i].second,
          n * 2 +
              upper_bound(h1 + 1, h1 + n * 2 + 1,
                          pair<long long, long long>(h1[i].first,
                                                     2333333333333333333LL)) -
              h1 - 1,
          1, 1);
  for (int i = 1; i <= n * 2; i++)
    h1[i] = pair<long long, long long>(num[i].first * mid + num[i].second, i);
  sort(h1 + 1, h1 + n * 2 + 1);
  for (int i = 1; i <= n * 2; i++) add(n * 4 + i, h1[i].second, 1061109567, 0);
  for (int i = 2; i <= n * 2; i++) add(n * 4 + i, n * 4 + i - 1, 1061109567, 0);
  for (int i = 1; i <= n * 2; i++)
    add(h1[i].second,
        n * 4 +
            upper_bound(h1 + 1, h1 + n * 2 + 1,
                        pair<long long, long long>(h1[i].first,
                                                   2333333333333333333LL)) -
            h1 - 1,
        1061109567, 1);
  ans = cost = 0;
  while (spfa()) {
    int lst;
    do {
      lst = ans;
      for (int i = vs; i <= vt; i++) cur[i] = head[i];
      ans += dfs(vs, 1061109567);
    } while (ans > lst);
  }
  return cost;
}
}  // namespace Gao
int main() {
  n = rd();
  for (int i = 1; i <= n * 2; i++) num[i].first = rd(), num[i].second = rd();
  int l = 0, r = 1000000000;
  while (l < r) {
    int mid = (l + r) >> 1;
    if (check(mid))
      r = mid;
    else
      l = mid + 1;
  }
  if (!check(l)) {
    puts("-1");
    return 0;
  }
  printf("%d %d\n", l, Gao::work(l));
  return 0;
}