#include <bits/stdc++.h>
long long gi() {
  long long x = 0, f = 1;
  char ch = getchar();
  while (!isdigit(ch)) f ^= ch == '-', ch = getchar();
  while (isdigit(ch)) x = x * 10 + ch - '0', ch = getchar();
  return f ? x : -x;
}
struct Line {
  int k, b, o;
} A[4510];
int n;
bool check(long long T) {
  std::vector<std::pair<long long, int>> s(n * 2 + 1);
  for (int i = 1; i <= n; ++i) {
    long long fin = 0;
    for (int j = 1; j <= n * 2; ++j)
      if (A[j].b <= A[i].b) fin = std::max(fin, A[j].b + A[j].k * T);
    s[i] = {fin, 1};
  }
  for (int i = n + 1; i <= n * 2; ++i) s[i] = {A[i].k * T + A[i].b, -1};
  std::sort(s.begin() + 1, s.end());
  for (int i = n * 2, c = 0; i; --i)
    if ((c += s[i].second) < 0) return 0;
  return 1;
}
int fir[13210], dis[700000], nxt[700000], w[700000], id = 1, cost[700000], S, T;
void link(int a, int b, int c, int d) {
  nxt[++id] = fir[a], fir[a] = id, dis[id] = b, w[id] = c, cost[id] = d;
  nxt[++id] = fir[b], fir[b] = id, dis[id] = a, w[id] = 0, cost[id] = -d;
}
bool inq[13210];
int que[13210], hd, tl;
int dist[13210], lst[13210];
int Cost;
bool Mincost() {
  hd = tl = 0;
  que[tl++] = S;
  memset(dist, 63, sizeof dist);
  dist[S] = 0;
  while (hd ^ tl) {
    int x = que[hd++];
    hd %= 13210;
    for (int i = fir[x]; i; i = nxt[i])
      if (w[i] && dist[dis[i]] > dist[x] + cost[i]) {
        dist[dis[i]] = dist[x] + cost[i];
        lst[dis[i]] = i;
        if (!inq[dis[i]]) inq[dis[i]] = 1, que[tl++] = dis[i], tl %= 13210;
      }
    inq[x] = 0;
  }
  if (dist[T] >= 1e9) return 0;
  int Flow = 1e9;
  for (int i = lst[T]; i; i = lst[dis[i ^ 1]]) Flow = std::min(Flow, w[i]);
  for (int i = lst[T]; i; i = lst[dis[i ^ 1]])
    Cost += cost[i] * Flow, w[i] -= Flow, w[i ^ 1] += Flow;
  return 1;
}
int main() {
  n = gi();
  for (int i = 1; i <= n * 2; ++i) A[i].k = gi(), A[i].b = gi(), A[i].o = i;
  long long l = 0, r = 2e9, mid, ans;
  while (l < r) {
    mid = l + (r - l >> 1);
    if (check(mid))
      r = mid;
    else
      l = mid + 1;
  }
  if (l == 2e9) return puts("-1"), 0;
  printf("%lld ", ans = l);
  S = 6 * n + 1, T = 6 * n + 2;
  for (int i = 1; i <= n; ++i) {
    link(S, i + n * 4, 1, 0), link(i + n * 4, i, 1, 1),
        link(i + n * 4, i + n * 2, 1, 0);
    link(i + n * 5, T, 1, 0);
    link(i + n * 3, i + n * 5, 1, 1), link(i + n, i + n * 5, 1, 0);
  }
  for (int i = 1; i <= n * 2; ++i) link(i, i + n * 2, 10000, 0);
  for (int i = 1; i <= n; ++i)
    std::sort(A + 1, A + n * 2 + 1, [&](Line a, Line b) { return a.b > b.b; });
  for (int l = 1, r; l <= n * 2; l = r + 1) {
    r = l;
    while (r < n * 2 && A[r + 1].b == A[r].b) ++r;
    for (int i = l; i <= r; ++i)
      if (i < n * 2) link(A[i].o, A[i + 1].o, 10000, 0);
    link(A[r].o, A[l].o, 10000, 0);
  }
  std::sort(A + 1, A + n * 2 + 1,
            [&](Line a, Line b) { return a.b + a.k * ans > b.b + b.k * ans; });
  for (int l = 1, r; l <= n * 2; l = r + 1) {
    r = l;
    while (r < n * 2 && A[r + 1].b + A[r + 1].k * ans == A[r].b + A[r].k * ans)
      ++r;
    for (int i = l; i <= r; ++i)
      if (i < n * 2) link(A[i].o + n * 2, A[i + 1].o + n * 2, 10000, 0);
    link(A[r].o + n * 2, A[l].o + n * 2, 10000, 0);
  }
  while (Mincost())
    ;
  printf("%d\n", Cost);
  return 0;
}
