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>
#pragma optimize("Ofase")
using namespace std;
const int N = 10000;
struct Graph {
  struct Edge {
    int to, nxt, c, key;
  } edge[40005];
  int head[N], top;
  Graph() { memset(head, -1, sizeof(head)), top = -1; }
  void init(int n) { memset(head, -1, sizeof(int) * (n + 1)), top = -1; }
  inline void add(int x, int y, int c, int key) {
    edge[++top] = (Edge){y, head[x], c, key};
    head[x] = top;
  }
} G;
void add2(int x, int y, int c, int key) {
  G.add(x, y, c, key);
  G.add(y, x, 0, -key);
}
struct K {
  int a, b, id;
  inline long long query(int x) { return 1ll * a * x + b; }
};
int ti;
inline bool cmp(K x, K y) {
  long long kx = x.query(ti), ky = y.query(ti);
  if (kx != ky) return kx < ky;
  return x.id > y.id;
}
namespace FLOW {
int iter[N], lev[N], q[N], left, right;
bool vis[N];
inline bool bfs(int s, int t, int n) {
  for (int i = 0; i <= n; ++i) lev[i] = 0, iter[i] = G.head[i], vis[i] = 0;
  left = right = 0;
  q[right++] = s;
  lev[s] = 1;
  while (left != right) {
    int x = q[left++];
    for (int j = G.head[x]; ~j; j = G.edge[j].nxt) {
      int y = G.edge[j].to;
      if (G.edge[j].c > 0 && lev[y] == 0) {
        lev[y] = lev[x] + 1;
        q[right++] = y;
      }
    }
  }
  return lev[t] > 0;
}
int dfs(int x, int o, int mi) {
  if (x == o) return mi;
  vis[x] = 1;
  int sum = 0;
  for (int& j = iter[x]; ~j; j = G.edge[j].nxt) {
    int y = G.edge[j].to;
    if (G.edge[j].c > 0 && lev[y] == lev[x] + 1 && !vis[y]) {
      int d = dfs(y, o, min(mi, G.edge[j].c));
      if (d > 0) {
        G.edge[j].c -= d;
        G.edge[j ^ 1].c += d;
        sum += d;
        if (sum == mi) break;
      }
    }
  }
  vis[x] = 0;
  return sum;
  return 0;
}
int max_flow(int s, int t, int n) {
  int ret = 0, d;
  while (bfs(s, t, n)) {
    while ((d = dfs(s, t, (int)1e9)) != 0) ret += d;
  }
  return ret;
}
inline pair<int, int> spfa(int s, int t, int n) {
  int *dis = iter, *pre = lev;
  for (int i = 0; i <= n; ++i) vis[i] = 0, dis[i] = (int)1e9, pre[i] = -1;
  left = right = 0;
  q[right++] = s;
  dis[s] = 0;
  vis[s] = 1;
  while (left != right) {
    int x = q[left++];
    vis[x] = 0;
    if (left > n + 2) left = 0;
    for (int j = G.head[x]; ~j; j = G.edge[j].nxt) {
      int y = G.edge[j].to;
      if (G.edge[j].c > 0 && dis[x] + G.edge[j].key < dis[y]) {
        dis[y] = dis[x] + G.edge[j].key;
        pre[y] = j;
        if (!vis[y]) {
          q[right++] = y;
          if (right > n + 2) right = 0;
          vis[y] = 1;
        }
      }
    }
  }
  if (pre[t] == -1) return make_pair(-1, -1);
  pair<int, int> ret(dis[t], (int)1e9);
  for (int j = pre[t]; ~j; j = pre[G.edge[j ^ 1].to])
    ret.second = min(ret.second, G.edge[j].c);
  for (int j = pre[t]; ~j; j = pre[G.edge[j ^ 1].to]) {
    G.edge[j].c -= ret.second;
    G.edge[j ^ 1].c += ret.second;
  }
  return ret;
}
pair<int, int> cost_flow(int s, int t, int n) {
  pair<int, int> ret(0, 0), d;
  while ((d = spfa(s, t, n)).second != -1) {
    ret.first += d.first * d.second;
    ret.second += d.second;
  }
  clock_t tt = clock();
  return ret;
}
}  // namespace FLOW
int n;
K a[N], b[N];
int rka[N], rkb[N], ida[N], idb[N];
pair<int, int> check(int time, int type = 0) {
  static int mx[N];
  ti = time;
  for (int i = 1; i <= n + n; ++i) b[i] = a[i];
  sort(b + 1, b + n + n + 1, cmp);
  G.init(n * 4 + 2);
  int top_node = n + n, s = ++top_node, t = ++top_node, ca = 0, cb = 0;
  for (int i = 1; i <= n; ++i) {
    add2(s, i, 1, 0);
    add2(i + n, t, 1, 0);
    if (type) {
      ida[i] = ++top_node, idb[i] = ++top_node;
      if (i > 1) {
        add2(ida[i], ida[i - 1], (int)1e9, 0);
        add2(idb[i], idb[i - 1], (int)1e9, 0);
      }
    }
  }
  for (int i = 1; i <= n + n; ++i) {
    if (a[i].id > n) {
      ++ca;
      if (type)
        add2(ida[ca], a[i].id, 1, 0);
      else
        ida[ca] = a[i].id;
    }
    if (b[i].id > n) {
      ++cb;
      if (type)
        add2(idb[cb], b[i].id, 1, 0);
      else
        idb[cb] = b[i].id;
    }
    rka[a[i].id] = ca;
    rkb[b[i].id] = cb;
  }
  mx[0] = 0;
  for (int i = 1; i <= n + n; ++i) mx[i] = max(mx[i - 1], rkb[a[i].id]);
  int lasta = 0, lastb = 0;
  for (int i = 1; i <= n + n; ++i)
    if (a[i].id <= n) {
      ti = 0;
      int pos = upper_bound(a + 1, a + n + n + 1, a[i], cmp) - a - 1;
      if (pos > 0) {
        if (rka[a[pos].id] > 0) {
          if (type) {
            add2(a[i].id, ida[rka[a[pos].id]], 1, 1);
          } else {
            if (lasta < rka[a[pos].id]) {
              ++lasta;
              add2(a[i].id, ida[lasta], 1, 1);
            }
          }
        }
        if (rkb[a[i].id] > 0)
          if (type) add2(a[i].id, idb[rkb[a[i].id]], 1, 1);
        if (mx[pos] > 0) {
          if (type)
            add2(a[i].id, idb[mx[pos]], 1, 2);
          else {
            if (lastb < mx[pos]) {
              ++lastb;
              add2(a[i].id, idb[lastb], 1, 2);
            }
          }
        }
      }
    }
  if (type == 0)
    return make_pair(FLOW::max_flow(s, t, top_node), 0);
  else
    return FLOW::cost_flow(s, t, top_node);
}
int main() {
  scanf("%d", &n);
  clock_t ss = clock();
  for (int i = 1; i <= n + n; ++i) scanf("%d%d", &a[i].a, &a[i].b), a[i].id = i;
  sort(a + 1, a + n + n + 1, cmp);
  int left = 0, right = (int)1e9 + 1;
  while (left < right) {
    int mid = left + right >> 1;
    if (check(mid).first == n)
      right = mid;
    else
      left = mid + 1;
  }
  clock_t tt = clock();
  if ((double)(tt - ss) / CLOCKS_PER_SEC > 5) exit(0);
  if (right == (int)1e9 + 1) {
    puts("-1");
    exit(0);
  } else {
    pair<int, int> ret = check(right, 1);
    printf("%d %d\n", right, ret.first);
  }
  return 0;
}