#include <bits/stdc++.h>
using namespace std;
const int N = 4400, INF = (1 << 30) - 1;
int n, a[N + 9], b[N + 9];
void into() {
  scanf("%d", &n);
  for (int i = 1; i <= n << 1; ++i) scanf("%d%d", &a[i], &b[i]);
}
struct state {
  int x;
  long long u, v;
  state(int X = 0, long long U = 0, long long V = 0) {
    x = X;
    u = U;
    v = V;
  }
} x[N + 9], y[N + 9], z[N + 9];
bool cmp0(const state &a, const state &b) {
  return a.u < b.u || a.u == b.u && (a.v > b.v || a.v == b.v && a.x < b.x);
}
bool cmp1(const state &a, const state &b) {
  return a.v < b.v || a.v == b.v && (a.u > b.u || a.u == b.u && a.x < b.x);
}
bool Check_mid(int mid) {
  for (int i = 1; i <= n << 1; ++i)
    x[i] = state(i, b[i], b[i] + 1LL * mid * a[i]);
  for (int i = 1; i <= n; ++i) z[i] = x[i + n];
  sort(x + 1, x + n * 2 + 1, cmp0);
  state mx = state(0, -1, -1);
  for (int i = 1; i <= n << 1; ++i) {
    if (x[i].v > mx.v) mx = x[i];
    if (x[i].x <= n) y[x[i].x] = mx;
  }
  sort(y + 1, y + n + 1, cmp1);
  sort(z + 1, z + n + 1, cmp1);
  for (int i = 1; i <= n; ++i)
    if (y[i].v < z[i].v) return 0;
  return 1;
}
int ans;
void Two_divide_ans() {
  int l = 0, r = INF;
  ans = r + 1;
  for (int mid; l <= r;
       Check_mid(mid = l + r >> 1) ? (ans = mid, r = mid - 1) : l = mid + 1)
    ;
}
int st, td, cn;
struct side {
  int y, next, f, v;
} e[N * 30 + 9];
int lin[N * 3 + 9], cs;
void Ins(int x, int y, int f, int v) {
  e[++cs].y = y;
  e[cs].f = f;
  e[cs].v = v;
  e[cs].next = lin[x];
  lin[x] = cs;
}
void Ins_flow(int x, int y, int f, int v) {
  Ins(x, y, f, v);
  Ins(y, x, 0, -v);
}
void Get_graph() {
  if (ans > INF) return;
  cs = 1;
  st = n * 6 + 1;
  td = cn = n * 6 + 2;
  for (int i = 1; i <= n << 1; ++i) {
    x[i] = y[i] = z[i] = state(i, b[i], b[i] + 1LL * ans * a[i]);
    i <= n ? Ins_flow(st, i, 1, 0) : Ins_flow(i + n * 4, td, 1, 0);
  }
  sort(x + 1, x + n * 2 + 1, cmp0);
  sort(y + 1, y + n * 2 + 1, cmp1);
  sort(z + 1, z + n + 1, cmp0);
  sort(z + n + 1, z + n * 2 + 1, cmp1);
  for (int i = 1, j = 1; i <= n; ++i) {
    for (; j <= n << 1 && z[i].u >= x[j].u; ++j)
      ;
    if (j > 1) Ins_flow(z[i].x, x[j - 1].x + n, INF, 1);
    Ins_flow(i, i + n * 3, INF, 0);
  }
  for (int i = 1; i <= n << 1; ++i) {
    if (i > 1) Ins_flow(x[i].x + n, x[i - 1].x + n, INF, 0);
    Ins_flow(i + n, i + n * 3, INF, 0);
    if (i > n) Ins_flow(i + n, i + n * 4, INF, 0);
  }
  for (int i = 1, j = 1; i <= n << 1; ++i) {
    if (i > 1) Ins_flow(y[i].x + n * 3, y[i - 1].x + n * 3, INF, 0);
    for (; j <= n && y[i].v >= z[j + n].v; ++j)
      ;
    if (j > 1) Ins_flow(y[i].x + n * 3, z[j + n - 1].x + n * 4, INF, 1);
    if (i > n) Ins_flow(i + n * 3, i + n * 4, INF, 1);
  }
}
void work() {
  Two_divide_ans();
  Get_graph();
}
int dis[N * 3 + 9], vis[N * 3 + 9], pre[N * 3 + 9], f[N * 3 + 9];
queue<int> q;
bool Spfa(int st, int td) {
  for (int i = 1; i <= cn; ++i) dis[i] = INF, vis[i] = 0;
  dis[st] = 0;
  vis[st] = 1;
  f[st] = INF;
  q.push(st);
  for (; !q.empty();) {
    int t = q.front();
    q.pop();
    vis[t] = 0;
    for (int i = lin[t]; i; i = e[i].next)
      if (e[i].f && dis[t] + e[i].v < dis[e[i].y]) {
        dis[e[i].y] = dis[t] + e[i].v;
        pre[e[i].y] = i;
        f[e[i].y] = min(f[t], e[i].f);
        if (!vis[e[i].y]) vis[e[i].y] = 0, q.push(e[i].y);
      }
  }
  return dis[td] ^ INF;
}
int Max_flow(int st, int td) {
  int res = 0, flow = 0;
  for (; Spfa(st, td); flow += f[td], res += f[td] * dis[td])
    for (int k = td; k ^ st; k = e[pre[k] ^ 1].y)
      e[pre[k]].f -= f[td], e[pre[k] ^ 1].f += f[td];
  assert(flow == n);
  return res;
}
void outo() {
  ans > INF ? puts("-1") : printf("%d %d\n", ans, Max_flow(st, td));
}
int main() {
  into();
  work();
  outo();
  return 0;
}
