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>
const int P = 998244353;
using namespace std;
template <typename T>
inline void ckmax(T &a, T b) {
  (a < b) && (a = b);
}
template <typename T>
inline void ckmin(T &a, T b) {
  (a > b) && (a = b);
}
inline int mul(int a, int b) { return 1ull * a * b % P; }
inline int add(int a, int b) { return a + b >= P ? a + b - P : a + b; }
inline int sub(int a, int b) { return a - b >= 0 ? a - b : a - b + P; }
inline void mulmod(int &a, int b) { a = mul(a, b); }
inline void addmod(int &a, int b) { ((a += b) >= P) && (a -= P); }
inline void submod(int &a, int b) { ((a -= b) < 0) && (a += P); }
inline int ksm(int a, int b) {
  int ans = 1;
  for (; b; b >>= 1) {
    if (b & 1) ans = 1ll * ans * a % P;
    a = 1ll * a * a % P;
  }
  return ans;
}
inline void fprint(const int &x, char c = ' ') {
  fprintf(stderr, "%d%c", x, c);
}
inline void fprint(const pair<int, int> &x, char c = '\n') {
  fprintf(stderr, "%d %d%c", x.first, x.second, c);
}
inline void fprint(const int *f, const int &n, char c = '\n') {
  for (int i = 1; i <= n; i++) fprint(f[i]);
  fprintf(stderr, "%c", c);
}
inline void fprint(const vector<int> &f, char c = '\n') {
  for (int i = 0; i < (int)f.size(); i++) fprint(f[i]);
  fprintf(stderr, "%c", c);
}
inline int inv(int a) { return ksm(a, P - 2); }
namespace FastIO {
const int SIZE = 1 << 16;
char buf[SIZE], obuf[SIZE], str[64];
int bi = SIZE, bn = SIZE, opt;
int read(char *s) {
  while (bn) {
    for (; bi < bn && buf[bi] <= ' '; bi++)
      ;
    if (bi < bn) break;
    bn = fread(buf, 1, SIZE, stdin), bi = 0;
  }
  int sn = 0;
  while (bn) {
    for (; bi < bn && buf[bi] > ' '; bi++) s[sn++] = buf[bi];
    if (bi < bn) break;
    bn = fread(buf, 1, SIZE, stdin), bi = 0;
  }
  s[sn] = 0;
  return sn;
}
bool read(int &x) {
  if (x) x = 0;
  int bf = 0, n = read(str);
  if (!n) return 0;
  int i = 0;
  if (str[i] == '-') bf = 1, i = 1;
  for (x = 0; i < n; i++) x = x * 10 + str[i] - '0';
  if (bf) x = -x;
  return 1;
}
void write(int x) {
  if (!x)
    obuf[opt++] = '0';
  else {
    if (x < 0) obuf[opt++] = '-', x = -x;
    int sn = 0;
    while (x) str[sn++] = x % 10 + '0', x /= 10;
    for (int i = sn - 1; i >= 0; i--) obuf[opt++] = str[i];
  }
  if (opt >= (SIZE >> 1)) {
    fwrite(obuf, 1, opt, stdout);
    opt = 0;
  }
}
void write(char x) {
  obuf[opt++] = x;
  if (opt >= (SIZE >> 1)) {
    fwrite(obuf, 1, opt, stdout);
    opt = 0;
  }
}
void Fflush() {
  if (opt) fwrite(obuf, 1, opt, stdout);
  opt = 0;
}
};  // namespace FastIO
inline int read() {
  int x;
  FastIO::read(x);
  return x;
}
const int MN = 4400 + 5;
int n;
struct Node {
  int A, B, bel;
  Node() {}
  Node(int a, int b) : A(a), B(b), bel(0) {}
} a[MN], b[MN], tmp[MN * 2];
long long getval(Node x, int t) { return 1ll * x.A * t + x.B; }
inline void fprint(const Node &x, char c = '\n') {
  fprintf(stderr, "%d %d %d%c", x.A, x.B, x.bel, c);
}
inline void fprint(const Node *f, const int &n, char c = '\n') {
  for (int i = 1; i <= n; i++) fprint(f[i]);
  fprintf(stderr, "%c", c);
}
int p[MN << 1], MID;
bool cmp(Node i, Node j) {
  if (getval(i, MID) != getval(j, MID)) return getval(i, MID) < getval(j, MID);
  return i.bel > j.bel;
}
int cnt[2 * MN];
bool check(int mid) {
  fprintf(stderr, "check on %d\n", mid);
  MID = mid;
  for (int i = (1); i <= (n); i++) tmp[i] = a[i];
  for (int i = (1); i <= (n); i++) tmp[i + n] = b[i], tmp[i + n].bel = 1;
  sort(tmp + 1, tmp + 1 + 2 * n, cmp);
  for (int i = (1); i <= (2 * n); i++) cnt[i] = 0;
  for (int i = (1); i <= (n); i++) {
    long long v = getval(a[i], 0);
    int ans = 0;
    for (int j = (0); j <= (2 * n); j++) {
      if (getval(tmp[j], 0) <= v &&
          (!ans || getval(tmp[j], MID) > getval(tmp[ans], MID) ||
           getval(tmp[j], MID) == getval(tmp[ans], MID) &&
               tmp[j].bel < tmp[ans].bel)) {
        ans = j;
      }
    }
    cnt[ans]++;
  }
  fprint(cnt, 2 * n);
  int now = 0;
  for (int i = (2 * n); i >= (1); i--) {
    cnt[i] += cnt[i + 1];
    now += tmp[i].bel;
    if (now > cnt[i]) return 0;
  }
  return 1;
}
struct Edge {
  int v, cap, cost, nxt;
};
struct DIJ_NODE {
  int u, y;
  DIJ_NODE(int tx, int ty) : u(tx), y(ty) {}
  bool operator<(const DIJ_NODE &b) const { return y > b.y; }
};
struct ZKW {
  static const int MAXN = MN << 3;
  static const int MAXM = MN << 4;
  int n, s, t, lst[MAXN], tot, vis[MAXN], cur[MAXN], dis[MAXN], maxflow,
      mincost;
  Edge e[MAXM << 1];
  void init(int tn, int ts, int tt) {
    n = tn, s = ts, t = tt, tot = 1;
    memset(dis, 0, sizeof(dis));
  }
  inline void addedge(int u, int v, int cap, int cost) {
    e[++tot] = (Edge){v, cap, cost, lst[u]};
    lst[u] = tot;
    e[++tot] = (Edge){u, 0, -cost, lst[v]};
    lst[v] = tot;
  }
  priority_queue<DIJ_NODE> q;
  int used[MAXN], h[MAXN];
  int DIJ() {
    for (int i = (0); i <= (n); i++)
      h[i] += dis[i], dis[i] = (1 << 30), used[i] = 0;
    dis[s] = 0;
    q.push(DIJ_NODE(s, 0));
    while (q.size()) {
      int u = q.top().u;
      q.pop();
      if (used[u]) continue;
      used[u] = 1;
      for (int i = lst[u], v = e[i].v; i; i = e[i].nxt, v = e[i].v) {
        if (e[i].cap && dis[u] + e[i].cost + h[u] - h[v] < dis[v]) {
          dis[v] = dis[u] + e[i].cost + h[u] - h[v];
          q.push(DIJ_NODE(v, dis[v]));
        }
      }
    }
    return dis[t] != (1 << 30);
  }
  int DFS(int u, int nowflow) {
    if (u == t) return nowflow;
    int flow = 0;
    vis[u] = 1;
    for (int &i = cur[u]; i; i = e[i].nxt) {
      int v = e[i].v, x;
      if (!vis[v] && dis[v] == dis[u] + e[i].cost + h[u] - h[v] && e[i].cap &&
          (x = DFS(v, min(nowflow, e[i].cap))))
        e[i].cap -= x, e[i ^ 1].cap += x, nowflow -= x, flow += x,
            mincost += x * e[i].cost;
      if (!nowflow) break;
    }
    return flow + (vis[u] = 0);
  }
  void Dinic() {
    maxflow = mincost = 0;
    while (DIJ()) {
      memcpy(cur, lst, sizeof(cur));
      int x = 0;
      while ((x = DFS(s, (1 << 30)))) maxflow += x;
    }
  }
  pair<int, int> solve() {
    Dinic();
    return make_pair(maxflow, mincost);
  }
} d;
int in[MN << 1], out[MN << 1], pre[MN << 1];
bool cmp1(int i, int j) { return getval(tmp[i], 0) < getval(tmp[j], 0); }
bool cmp2(int i, int j) {
  if (getval(tmp[i], MID) != getval(tmp[j], MID))
    return getval(tmp[i], MID) < getval(tmp[j], MID);
  return i > j;
}
int doit(int x) {
  MID = x;
  int s = 0, t = 8 * n + 1;
  for (int i = (1); i <= (n); i++) tmp[i] = a[i];
  for (int i = (1); i <= (n); i++) tmp[i + n] = b[i], tmp[i + n].bel = 1;
  for (int i = (1); i <= (2 * n); i++) {
    p[i] = i;
  }
  d.init(t, s, t);
  for (int i = (1); i <= (2 * n); i++) {
    in[i] = i * 2 - 1, out[i] = i * 2;
    if (i <= n)
      d.addedge(s, in[i], 1, 0);
    else
      d.addedge(out[i], t, 1, 0);
    d.addedge(in[i], out[i], ((1 << 30) - 1), 0);
  }
  sort(p + 1, p + 1 + 2 * n, cmp1);
  pre[1] = in[p[1]];
  for (int i = (2); i <= (2 * n); i++) {
    pre[i] = 4 * n + i;
    d.addedge(pre[i], pre[i - 1], ((1 << 30) - 1), 0);
    d.addedge(pre[i], in[p[i]], ((1 << 30) - 1), 0);
  }
  for (int i = (2); i <= (2 * n); i++)
    d.addedge(in[p[i]], pre[i - 1], ((1 << 30) - 1), 1);
  sort(p + 1, p + 1 + 2 * n, cmp2);
  pre[1] = out[p[1]];
  for (int i = 2; i <= 2 * n; i++) {
    pre[i] = 6 * n + i;
    d.addedge(pre[i], pre[i - 1], ((1 << 30) - 1), 0);
    d.addedge(pre[i], out[p[i]], ((1 << 30) - 1), 0);
  }
  for (int i = (2); i <= (2 * n); i++)
    d.addedge(out[p[i]], pre[i - 1], ((1 << 30) - 1), 1);
  return d.solve().second;
}
signed main() {
  n = read();
  for (int i = 1; i <= n; i++) {
    a[i].A = read(), a[i].B = read();
  }
  for (int i = 1; i <= n; i++) {
    b[i].A = read(), b[i].B = read();
  }
  int l = 0, r = 1e9, ans = -1;
  while (l <= r) {
    int mid = (l + r) >> 1;
    if (check(mid)) {
      r = mid - 1, ans = mid;
    } else
      l = mid + 1;
  }
  cout << ans << ' ';
  if (ans == -1) return 0;
  cout << doit(ans) << endl;
  return FastIO::Fflush(), 0;
}