    #include <bits/stdc++.h>
    #define get suka
    #define to_str blyad
    #define ll long long
    #define db long double
    #define x first
    #define y second
    #define mp make_pair
    #define pb push_back
    #define all(a) a.begin(), a.end()
     
    using namespace std;
     
    struct Piece{int a; int b; int index;};
     
    bool cmp(Piece &a, Piece &b){
    	return (a.b < b.b);
    }
     
    bool cmp2(Piece &a, Piece &b){
    	return (a.a < b.a);
    }
     
     
    struct Vertex{ll sum; int cnt;};
     
    vector<Vertex> rmq;
     
    bool more(ll a, ll b, ll c, ll d){
    	__int128_t A = a, B = b, C = c, D = d;
    	return (A*D >= B*C);
    }
     
    __int128_t gcd(__int128_t x, __int128_t y){
    	if (y==0) return x;
    	return gcd(y, x%y);
    }
     
    string to_str(__int128_t x){
    	string res = "";
    	if (x==0) return "0";
    	while (x > 0){
    		res += (char) ('0' + x%10);
    		x /= 10;
    	}
    	reverse(res.begin(), res.end());
    	return res;
    }
     
    pair<ll, int> get(int i, int l, int r, ll delta){
    	if (r-l==1){
    		if (rmq[i].cnt == 0) return {0, 0};
    		if (rmq[i].sum > delta) return {0, 0};
    		return {rmq[i].sum, 1};
    	}
    	int mid = (l+r)/2;
    	if (rmq[2*i+1].sum > delta){
    		return get(2*i+1, l, mid, delta);
    	}
    	ll S = rmq[2*i+1].sum;
    	int c = rmq[2*i+1].cnt;
    	pair<ll, int> res = get(2*i+2, mid, r, delta-S);
    	return {res.first+S, res.second+c};
    }
     
    void change(int i, int l, int r, int index, ll val){
    	if (r-l==1){
    		rmq[i] = {val, 1};
    		return;
    	}
    	int mid = (l+r)/2;
    	if (index < mid) change(2*i+1, l, mid, index, val);
    	else change(2*i+2, mid, r, index, val);
    	rmq[i].sum = rmq[2*i+1].sum + rmq[2*i+2].sum;
    	rmq[i].cnt = rmq[2*i+1].cnt + rmq[2*i+2].cnt;
    }
     
    int main(){
    #ifdef LOCAL
    	freopen("A_input.txt", "r", stdin);
    	//freopen("A_output.txt", "w", stdout);
    #endif
    	ios_base::sync_with_stdio(0);
    	cin.tie(0);
    	int n;
    	cin >> n;
    	vector<Piece> v;
    	for (int i=0; i < n; ++i){
    		int a, b;
    		cin >> a >> b;
    		v.push_back({a, b, i});
    	}
     
    	sort(v.begin(), v.end(), cmp2);
    	rmq.assign(4*n, {0, 0});
     
    	vector<int> posa(n);
     
    	for (int i=0; i < n; ++i){
    		posa[v[i].index] = i;
    	}
     
    	sort(v.begin(), v.end(), cmp);
     
    	ll delta = 0;
    	ll A = 0, e = 0, q = 1;
    	for (int i=0;i<n;++i){
    		if (v[i].b >= v[i].a) delta += (v[i].b - v[i].a);
    	}
    	for (int i=0; i < n; ++i){
    		if (v[i].b >= v[i].a){
    			delta -= (v[i].b - v[i].a);
    			pair<ll, int> p = get(0, 0, n, delta+(v[i].b - v[i].a));
    			ll C = v[i].b-v[i].a-(p.first - delta), zn = v[i].b;
    			//cout << i << " " << p.first << " " << p.second << " " << delta << " " << C << " " << zn << endl;
    			if (C >= zn){
    				C = 0, zn = 1, p.second++;
    			}
    			if (p.second > A){
    				A = p.second, e = C, q = zn;
    			}
    			else if (p.second == A){
    				if (more(C, zn, e, q)){
    					e = C, q = zn;
    				}
    			}
    		}
    		else{
	    		pair<ll, int> p = get(0, 0, n, delta+(v[i].b - v[i].a));
				ll C = v[i].b-v[i].a-(p.first - delta), zn = v[i].b;
				if (C >= 0){
					//cout << i << " " << p.first << " " << p.second << " " << delta << " " << C << " " << zn << endl;
					if (C >= zn){
						C = 0, zn = 1, p.second++;
					}
					if (p.second > A){
						A = p.second, e = C, q = zn;
					}
					else if (p.second == A){
						if (more(C, zn, e, q)){
							e = C, q = zn;
						}
					}
				}
	    	}
    		int I = v[i].index;
    		change(0, 0, n, posa[I], v[i].a);
    	}
    	//cout << A << " " << e << " " << q << endl;
    	__int128_t a = A, E = e, Q = q;
    	E += Q*a;
    	Q *= n;
    	__int128_t g = gcd(E, Q);
    	E /= g, Q /= g;
    	string T = to_str(E), B = to_str(Q);
    	cout << T << " " << B;
     
    }