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 signed int inf = (signed)(~0u >> 1);
template <typename T>
void pfill(T* pst, const T* ped, T val) {
  for (; pst != ped; *(pst++) = val)
    ;
}
typedef class Edge {
 public:
  int ed, nx, r, c;
  Edge(int ed = 0, int nx = 0, int r = 0, int c = 0)
      : ed(ed), nx(nx), r(r), c(c) {}
} Edge;
typedef class MapManager {
 public:
  int* h;
  vector<Edge> es;
  MapManager() {}
  MapManager(int n) {
    h = new int[(n + 1)];
    pfill(h, h + n + 1, -1);
  }
  ~MapManager() {
    delete[] h;
    es.clear();
  }
  void addEdge(int u, int v, int r, int c = 0) {
    es.push_back(Edge(v, h[u], r, c));
    h[u] = (signed)es.size() - 1;
  }
  void addArc(int u, int v, int cap, int c = 0) {
    addEdge(u, v, cap, c);
    addEdge(v, u, 0, -c);
  }
  Edge& operator[](int p) { return es[p]; }
} MapManager;
typedef class Network {
 public:
  int S, T;
  int *cur, *div;
  MapManager g;
  bool* vis;
  int *f, *le, *mf;
  Network() {}
  Network(int S, int T) : S(S), T(T), g(T + 1) {
    cur = new int[(T + 1)];
    div = new int[(T + 1)];
    vis = new bool[(T + 1)];
    f = new int[(T + 1)];
    le = new int[(T + 1)];
    mf = new int[(T + 1)];
  }
  ~Network() {
    delete[] cur;
    delete[] div;
  }
  bool bfs() {
    static queue<int> que;
    pfill(div, div + T + 1, -1);
    div[S] = 0;
    que.push(S);
    while (!que.empty()) {
      int e = que.front();
      que.pop();
      for (int i = g.h[e], eu; ~i; i = g[i].nx) {
        if (!g[i].r) continue;
        eu = g[i].ed;
        if (!~div[eu]) {
          div[eu] = div[e] + 1;
          que.push(eu);
        }
      }
    }
    return ~div[T];
  }
  int dfs(int p, int minf) {
    if (p == T || !minf) return minf;
    int flow = 0, f;
    for (int &i = cur[p], e; (~i); i = cur[p], i = g[i].nx) {
      e = g[i].ed;
      if (div[e] == div[p] + 1 && (f = dfs(e, min(minf, g[i].r))) > 0) {
        flow += f;
        g[i].r -= f;
        g[i ^ 1].r += f;
        minf -= f;
        if (!minf) {
          break;
        }
      }
    }
    return flow;
  }
  int dinic() {
    int times = 0;
    int rt = 0;
    while (bfs()) {
      for (int i = 0; i <= T; i++) cur[i] = g.h[i];
      rt += dfs(S, inf);
      times++;
    }
    cerr << "argue time: " << times << '\n';
    return rt;
  }
  int spfa() {
    queue<int> Q;
    for (int i = 0; i <= T; i++) {
      f[i] = inf >> 1, vis[i] = false;
    }
    f[S] = 0, mf[S] = inf, le[S] = -1;
    Q.push(S);
    while (!Q.empty()) {
      int e = Q.front();
      Q.pop();
      vis[e] = false;
      for (int i = g.h[e]; ~i; i = g[i].nx) {
        int eu = g[i].ed, w = f[e] + g[i].c;
        if (g[i].r <= 0) {
          continue;
        }
        if (w < f[eu]) {
          f[eu] = w, le[eu] = i, mf[eu] = min(mf[e], g[i].r);
          if (!vis[eu]) {
            Q.push(eu);
            vis[eu] = true;
          }
        }
      }
    }
    if (f[T] == (inf >> 1)) return inf;
    for (int p = T, e; p ^ S; p = g[le[p] ^ 1].ed) {
      e = le[p];
      g[e].r -= mf[T];
      g[e ^ 1].r += mf[T];
    }
    return f[T] * mf[T];
  }
  int min_cost() {
    int rt = 0, d;
    while ((d = spfa()) ^ inf) {
      rt += d;
    }
    return rt;
  }
} Network;
const int N = 2205, N2 = N << 1;
int n, mb;
long long vab[N2];
Network* network;
int a[N2], b[N2], vb[N2];
void build(int mid) {
  int T, n2 = n << 1, n4 = n << 2, n6 = n2 + n4;
  network = new Network(0, T = 10 * n + 1);
  MapManager& g = network->g;
  for (int i = 1; i <= n; i++) g.addArc(0, i, 1);
  for (int i = 1; i <= n2; i++) {
    int db = lower_bound(vb + 1, vb + mb + 1, b[i]) - vb;
    if (i <= n) g.addArc(i, n6 + db, 1, 1);
    g.addArc(n6 + db, n2 + i, inf);
    if (i <= n) g.addArc(i, n2 + i, 1);
  }
  for (int i = 1; i < mb; i++) g.addArc(n6 + i + 1, n6 + i, inf);
  for (int i = 1; i <= n2; i++) {
    vab[i] = b[i] + 1ll * a[i] * mid;
  }
  sort(vab + 1, vab + n2 + 1);
  int mab = unique(vab + 1, vab + n2 + 1) - vab - 1;
  for (int i = 1; i <= n2; i++) {
    int d = lower_bound(vab + 1, vab + mab + 1, b[i] + 1ll * a[i] * mid) - vab;
    g.addArc(n2 + i, n6 + mb + d, inf, 1);
    if (i > n) g.addArc(n6 + mb + d, n4 + i, inf);
    if (i > n) g.addArc(n2 + i, n4 + i, 1);
  }
  for (int i = 1; i < mab; i++) g.addArc(n6 + mb + i + 1, n6 + mb + i, inf);
  for (int i = n + 1; i <= n2; i++) g.addArc(n4 + i, T, 1);
}
int c[N2];
bool check(int mid) {
  static vector<pair<long long, int> > V;
  V.clear();
  int n2 = n << 1;
  for (int i = 1; i <= n2; i++) {
    V.emplace_back(b[i], i);
    vab[i] = a[i] * 1ll * mid + b[i];
    c[i] = 0;
  }
  sort(V.begin(), V.end(), [&](pair<long long, int> a, pair<long long, int> b) {
    return (a.first ^ b.first) ? (a.first < b.first) : (a.second > b.second);
  });
  int id = -1;
  long long mx = -1e18;
  for (auto par : V) {
    if (vab[par.second] > mx) {
      id = par.second;
      mx = vab[par.second];
    }
    if (par.second <= n) {
      c[id]++;
    }
  }
  for (int i = 1; i <= n2; i++) V[i - 1] = pair<long long, int>(vab[i], i);
  sort(V.begin(), V.end());
  for (int i = 1; i < n2; i++) {
    if (V[i - 1].first == V[i].first) {
      c[V[i].second] += c[V[i - 1].second];
      c[V[i - 1].second] = 0;
    }
  }
  reverse(V.begin(), V.end());
  int sum = 0;
  for (auto par : V) {
    sum += c[par.second] - (par.second > n);
    if (sum < 0) {
      return false;
    }
  }
  return true;
}
int main() {
  scanf("%d", &n);
  int n2 = n << 1;
  for (int i = 1; i <= n2; i++) {
    scanf("%d%d", a + i, b + i);
    vb[i] = b[i];
  }
  sort(vb + 1, vb + n2 + 1);
  mb = unique(vb + 1, vb + n2 + 1) - vb - 1;
  int l = 0, r = 1e9, mid;
  while (l <= r) {
    mid = (l + r) >> 1;
    if (check(mid)) {
      r = mid - 1;
    } else {
      l = mid + 1;
    }
  }
  if (++r > 1000000000) {
    puts("-1");
  } else {
    build(r);
    int ans = network->min_cost();
    printf("%d %d\n", r, ans);
  }
  return 0;
}