#include<bits/stdc++.h>
#define lsc(x) scanf("%lld",&x)
#define sc(x) scanf("%d",&x)
#define lpr(x) printf("%lld ",x)
#define pr(x) printf("%d ",x)
#define n_l printf("\n")
#define VI vector<int>
#define VII vector<long long int>
#define m_p make_pair
#define pb push_back
#define fi first
#define se second
#define mset(x,y) memset(x,y,sizeof(x))
using namespace std;
const int N=(int)1e6+5;
const int mod = 1000000007;
typedef long long ll;
int a[N];
ll dp[N];
ll dp0[N];
ll gcd (ll a, ll b)
{
    ll r = a%b;
    while (r) {
        a = b;
        b = r;
        r = a % b;
    }
    return b;
}

int main(){
    int n;sc(n);
    for (int i=1;i<=n;i++) sc(a[i]);
    ll ans=0;
    ll tot=0;
    sort(a+1,a+1+n);
    for (int i=1;i<=n;i++){
        ans+=(a[i])*1LL*(i-1) - tot;
        tot+=a[i];
    }
    tot+=(ans)*2;
    ll fact=gcd(tot,n);
    lpr(tot/fact);lpr(n/fact);n_l;
    return 0;
}


#include<iostream>
#include<algorithm>
#include<string>
#include<cstring>
#include<unordered_map>
#include<vector>
#include<queue>
#include<numeric>
#include<cmath>
#include<set>
#include<map>

#if DEBUG && !ONLINE_JUDGE
	#include "debugger.cpp"
#else
    #define debug(args...)
	#define printMatrix(args...)
    #define printArray(args...)
    #define printSegmentTree(args...)
#endif

#define pb push_back
#define mp make_pair
#define so sizeof
#define FOR(i,a,b) for(int i=a;i<b;++i)
#define REP(i,n) FOR(i,0,n)
#define all(x) (x).begin(), (x).end()
#define pii pair<int,int>

#define lli long long int
#define MOD 1000000007
using namespace std;
const int MAXN = 1e5+5;
const int MAXR = 1;
const int MAXC = 1;
const int INF = (int)1e9;
priority_queue<int, vector<int>, greater<int>> q1;
priority_queue<int, vector<int>, less<int>> q2;
int arr[MAXN];

int x4[] = {-1,0,1,0};
int y4[] = {0,1,0,-1};

void solve(int n){
	sort(arr, arr + n, greater<int>());
	printArray(arr, n);
	lli ssum = 0;
	FOR(i,0,n)ssum+=arr[i];
	debug(ssum);

	lli x = n - 1;
	lli csum = 0;
	FOR(i,0,n/2){
		csum+= (x) * (arr[i] - arr[n-i-1]);
		x = x-2;
	}
	debug(csum);

	lli nume = ssum + 2 * csum;
	lli denm = n;
	lli g = __gcd(nume, denm);

	lli x1 = nume/g;
	lli x2 = denm/g;
	cout<<x1<<" "<<x2;

}

int main(void){
	#ifndef ONLINE_JUDGE
        freopen("input.txt", "r+", stdin);
        //freopen("output.txt", "w+", stdout);
    #endif
    ios::sync_with_stdio(false);
    int n;cin>>n;FOR(i,0,n)cin>>arr[i];
    solve(n);
	return 0;
}


#include <iostream>
#include <iomanip>
#include <cstdlib>
#include <algorithm>
#include <fstream>
#include <cstdio>
#include <cmath>
#include <cstring>
#include <string>
#include <ctime>
#include <queue>
#include <stack>
#include <vector>
#include <map>
#include <set>
#include <deque>
#include <cassert>
#include <unordered_map>
#include <bitset>
#include <unordered_set>

using namespace std;

#define pb push_back
#define pp pop_back
#define f first
#define s second
#define mp make_pair
#define sz(a) (int)((a).size())
#ifdef _WIN32
#  define I64 "%I64d"
#else
#  define I64 "%lld"
#endif
#define fname "."

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair < int, int > pi;

const int MAX_N = (int)2e5 + 123;
const int mod = (int)1e9 + 7;

int n;
int a[MAX_N];

ll gcd(ll a, ll b) {
    while(a) {
        swap(a, b);
        a %= b;
    }
    return b;
}

int main() {
#ifdef DEBUG
    freopen("input.txt", "r", stdin);
#endif
    scanf("%d", &n);
    for (int i = 1; i <= n; i++)
        scanf("%d", &a[i]);
    sort(a + 1, a + n + 1);
    ll sum = 0, all = 0;
    for (int i = 1; i <= n; i++) {
        all += ((i - 1) * 1ll * a[i] - sum) * 2ll;
        sum += a[i];
        all += a[i];
    }
    ll down = n;
    ll g = gcd(all, down);
    all /= g, down /= g;
    printf("%lld %lld", all, down);
    return 0;
}


#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <iostream>
#include <map>
#include <math.h>
#include <numeric>
#include <list>
#include <queue>
#include <string>
#include <vector>
#include <set>
#include <sstream>
#include <cstdio>
#include <cstring>
#include <stack>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<long long,long long> pll;
typedef vector<vector<int>> vvi;
typedef vector<vector<int>> vi;
typedef pair<pair<int,int>, int> ppiii;
typedef pair<int, pair<int,int>> pipii;
typedef pair<int,char> pic;
typedef pair<char,int> pci;
typedef pair<string,string> pss;

ll gcd(ll a, ll b) {
  if (a < b) swap(a,b);
  if (b==0) return a;
  return gcd(b,a%b);
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  ll n;
  cin >> n;
  vector<ll> in(n);
  sort(in.begin(), in.end());
  ll tot = 0;
  for (auto& it : in) {
    cin >> it;
    tot += it;
  }
  for (int i = 1; i < n; i++) {
    ll left = i;
    ll right = n - i;
    ll diff = abs(in[i] - in[i-1]);
    tot += diff * left * right * 2;
  }
  ll gccd = gcd(tot, n);
  tot /= gccd;
  n /= gccd;
  cout << tot << " " << n;

}


#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <iostream>
#include <map>
#include <math.h>
#include <numeric>
#include <list>
#include <queue>
#include <string>
#include <vector>
#include <set>
#include <sstream>
#include <cstdio>
#include <cstring>
#include <stack>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<long long,long long> pll;
typedef vector<vector<int>> vvi;
typedef vector<vector<int>> vi;
typedef pair<pair<int,int>, int> ppiii;
typedef pair<int, pair<int,int>> pipii;
typedef pair<int,char> pic;
typedef pair<char,int> pci;
typedef pair<string,string> pss;

bool compareInterval(pll& i1, pll& i2) {
  ll sum1 = i1.first + i2.second;
  ll sum2 = i1.second + i2.first;
  return sum1 < sum2;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  ll n;
  cin >> n;
  vector<ll> in(n);
  sort(in.begin(), in.end());
  ll tot = 0;
  for (auto& it : in) {
    cin >> it;
    tot += it;
  }
  for (int i = 1; i < n; i++) {
    ll left = i;
    ll right = n - i;
    ll diff = abs(in[i] - in[i-1]);
    tot += diff * left * right * 2;
  }
  cout << tot << " " << n;

}


#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <iostream>
#include <map>
#include <math.h>
#include <numeric>
#include <list>
#include <queue>
#include <string>
#include <vector>
#include <set>
#include <sstream>
#include <cstdio>
#include <cstring>
#include <stack>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<long long,long long> pll;
typedef vector<vector<int>> vvi;
typedef vector<vector<int>> vi;
typedef pair<pair<int,int>, int> ppiii;
typedef pair<int, pair<int,int>> pipii;
typedef pair<int,char> pic;
typedef pair<char,int> pci;
typedef pair<string,string> pss;

bool compareInterval(pll& i1, pll& i2) {
  ll sum1 = i1.first + i2.second;
  ll sum2 = i1.second + i2.first;
  return sum1 < sum2;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  ll n;
  cin >> n;
  vector<ll> in(n);
  ll tot = 0;
  for (auto& it : in) {
    cin >> it;
    tot += it;
  }
  for (int i = 1; i < n; i++) {
    ll left = i;
    ll right = n - i;
    ll diff = abs(in[i] - in[i-1]);
    tot += diff * left * right * 2;
  }
  cout << tot << " " << n;

}


#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <iostream>
#include <map>
#include <math.h>
#include <numeric>
#include <list>
#include <queue>
#include <string>
#include <vector>
#include <set>
#include <sstream>
#include <cstdio>
#include <cstring>
#include <stack>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<long long,long long> pll;
typedef vector<vector<int>> vvi;
typedef vector<vector<int>> vi;
typedef pair<pair<int,int>, int> ppiii;
typedef pair<int, pair<int,int>> pipii;
typedef pair<int,char> pic;
typedef pair<char,int> pci;
typedef pair<string,string> pss;

ll gcd(ll a, ll b) {
  if (a < b) swap(a,b);
  if (b==0) return a;
  return gcd(b,a%b);
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  ll n;
  cin >> n;
  vector<ll> in(n);

  ll tot = 0;
  for (auto& it : in) {
    cin >> it;
    tot += it;
  }
  sort(in.begin(), in.end());
  for (int i = 1; i < n; i++) {
    ll left = i;
    ll right = n - i;
    ll diff = abs(in[i] - in[i-1]);
    //cout << in[i] << " " << left << " " << right << " " << diff << endl;
    tot += diff * left * right * 2;
  }
  ll gccd = gcd(tot, n);
  tot /= gccd;
  n /= gccd;
  cout << tot << " " << n;

}


#include <bits/stdc++.h>
#include <assert.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define PB push_back
#define MP make_pair
const int MOD=1000000007;
#define endl "\n"
#define fst first
#define snd second
const ll UNDEF = -1;
const ll INF=1e18;
template<typename T> inline bool chkmax(T &aa, T bb) { return aa < bb ? aa = bb, true : false; }
template<typename T> inline bool chkmin(T &aa, T bb) { return aa > bb ? aa = bb, true : false; }
typedef pair<ll,ll> pll;
typedef vector<ll> vll;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<vi> vvi;
#define DEBUG_CAT
#ifdef DEBUG_CAT

#define dbg(...)   printf( __VA_ARGS__ )
#else
#define dbg(...)   /****nothing****/
#endif
static char stdinBuffer[1024];
static char* stdinDataEnd = stdinBuffer + sizeof (stdinBuffer);
static const char* stdinPos = stdinDataEnd;

void readAhead(size_t amount)
{
    size_t remaining = stdinDataEnd - stdinPos;
    if (remaining < amount) {
       memmove(stdinBuffer, stdinPos, remaining);
       size_t sz = fread(stdinBuffer + remaining, 1, sizeof (stdinBuffer) - remaining, stdin);
       stdinPos = stdinBuffer;
       stdinDataEnd = stdinBuffer + remaining + sz;
       if (stdinDataEnd != stdinBuffer + sizeof (stdinBuffer))
         *stdinDataEnd = 0;
    }
}

int rint()
{
    readAhead(16);

    int x = 0;
    bool neg = false;
    while(*stdinPos==' '||*stdinPos=='\n') ++stdinPos;
    if (*stdinPos == '-') {
       ++stdinPos;
       neg = true;
    }

    while (*stdinPos >= '0' && *stdinPos <= '9') {
       x *= 10;
       x += *stdinPos - '0';
       ++stdinPos;
    }

    return neg ? -x : x;
}
char rch()
{
    readAhead(16);
    while(*stdinPos==' '||*stdinPos=='\n') ++stdinPos;
    char ans=*stdinPos;
    ++stdinPos;
    return ans;
}
long long rlong()
{
    readAhead(32);

    long long x = 0;
    bool neg = false;
    while(*stdinPos==' '||*stdinPos=='\n') ++stdinPos;
    if (*stdinPos == '-') {
       ++stdinPos;
       neg = true;
    }

    while (*stdinPos >= '0' && *stdinPos <= '9') {
       x *= 10;
       x += *stdinPos - '0';
       ++stdinPos;
    }

    return neg ? -x : x;
}
const int mn=1e5+2;
int a[mn];
int main()
{
	ios_base::sync_with_stdio(false); cin.tie(0);
	int n=rint();
	for (int i=0;i<n;i++) a[i]=rint();
	sort(a,a+n);
	ll presum=0;
	ll all=0;
	for (int i=0;i<n;i++) {
		ll x=a[i];
		ll contrib=x*i-presum;
		//printf("x:%lld i:%lld presum:%lld contrib:%lld\n",x,i,presum,contrib);
		all+=contrib;
		presum+=x;
	}
	ll numer=2*all+presum;
	ll denom=n;
	ll g=__gcd(numer,denom);
	numer/=g; denom/=g;
	printf("%lld %lld\n",numer,denom);
}


#include<bits/stdc++.h>

#define N 100009

using namespace std;

int a[N];
long long int pre[N];

int main(){
	int i,j,t1,t2,t3,t4,n;
	long long num,den,buf1,buf2,buf3,buf4;
	scanf("%d",&n);
	for(i=0;i<n;i++){
		scanf("%d",&a[i]);
	}
	pre[0]=a[0];
	for(i=1;i<n;i++){
		pre[i]=pre[i-1]+a[i];
	}
	sort(a,a+n);
	num=pre[n-1];
	for(i=1;i<n;i++){
		buf1=1ll*i*a[i];
		buf1-=pre[i-1];
		buf1*=2;
		num+=buf1;
	}
	den=n;
	buf1=__gcd(num,den);
	num/=buf1;
	den/=buf1;
	printf("%lld %lld\n",num,den);
	return 0;
}


#include<bits/stdc++.h>

#define N 100009

using namespace std;

long long int a[N];
long long int pre[N];

int main(){
	long long int i,j,t1,t2,t3,t4,n;
	long long int num,den,buf1,buf2,buf3,buf4;
	scanf("%lld",&n);
	for(i=0;i<n;i++){
		scanf("%lld",&a[i]);
	}
	pre[0]=a[0];
	for(i=1;i<n;i++){
		pre[i]=pre[i-1]+a[i];
	}
	sort(a,a+n);
	num=pre[n-1];
	for(i=1;i<n;i++){
		buf1=1ll*i*a[i];
		buf1-=pre[i-1];
		buf1*=2;
		num+=buf1;
	}
	den=n;
	buf1=__gcd(num,den);
	num/=buf1;
	den/=buf1;
	printf("%lld %lld\n",num,den);
	return 0;
}


#include<bits/stdc++.h>

#define N 100009

using namespace std;

int a[N];
long long int pre[N];

int main(){
	int i,j,t1,t2,t3,t4,n;
	long long num,den,buf1,buf2,buf3,buf4;
	scanf("%d",&n);
	for(i=0;i<n;i++){
		scanf("%d",&a[i]);
	}
	pre[0]=a[0];
	for(i=1;i<n;i++){
		pre[i]=pre[i-1]+a[i];
	}
	sort(a,a+n);
	num=pre[n-1];
	for(i=0;i<n;i++){
		if(i>0){
			buf1=1ll*i*a[i];
			buf1-=pre[i-1];
			buf1*=2;
			num+=buf1;
		}
	}
	den=n;
	buf1=__gcd(num,den);
	num/=buf1;
	den/=buf1;
	printf("%lld %lld\n",num,den);
	return 0;
}


#include<bits/stdc++.h>

#define N 100009

using namespace std;

int a[N];
long long int pre[N];

long long int gcd(long long int a1,long long int b1){
    if(a1==0)
        return b1;
    return gcd(b1%a1,a1);
}

int main(){
	int i,j,t1,t2,t3,t4,n;
	long long int num,den,buf1,buf2,buf3,buf4;
	scanf("%d",&n);
	for(i=0;i<n;i++){
		scanf("%d",&a[i]);
	}
	sort(a,a+n);
	pre[0]=a[0];
	for(i=1;i<n;i++){
		pre[i]=pre[i-1]+a[i];
	}
	num=pre[n-1];
	for(i=1;i<n;i++){
		buf1=1ll*i*a[i];
		buf1-=pre[i-1];
		buf1*=2;
		num+=buf1;
	}
	den=n;
	buf1=gcd(num,den);
	num/=buf1;
	den/=buf1;
	printf("%lld %lld\n",num,den);
	return 0;
}


#include<bits/stdc++.h>

#define N 100009

using namespace std;

int a[N];
long long int pre[N];

int main(){
	int i,j,t1,t2,t3,t4,n;
	long long int num,den,buf1,buf2,buf3,buf4;
	scanf("%d",&n);
	for(i=0;i<n;i++){
		scanf("%d",&a[i]);
	}
	pre[0]=a[0];
	for(i=1;i<n;i++){
		pre[i]=pre[i-1]+a[i];
	}
	sort(a,a+n);
	num=pre[n-1];
	for(i=1;i<n;i++){
		buf1=1ll*i*a[i];
		buf1-=pre[i-1];
		buf1*=2;
		num+=buf1;
	}
	den=n;
	buf1=__gcd(num,den);
	num/=buf1;
	den/=buf1;
	printf("%lld %lld\n",num,den);
	return 0;
}


#include<bits/stdc++.h>

#define N 100009

using namespace std;

int a[N];
long long int pre[N];

long long int gcd(long long int a1,long long int b1){
    if(a1==0)
        return b1;
    return gcd(b1%a1,a1);
}

int main(){
	int i,j,t1,t2,t3,t4,n;
	long long int num,den,buf1,buf2,buf3,buf4;
	scanf("%d",&n);
	for(i=0;i<n;i++){
		scanf("%d",&a[i]);
	}
	pre[0]=a[0];
	for(i=1;i<n;i++){
		pre[i]=pre[i-1]+a[i];
	}
	sort(a,a+n);
	num=pre[n-1];
	for(i=1;i<n;i++){
		buf1=1ll*i*a[i];
		buf1-=pre[i-1];
		buf1*=2;
		num+=buf1;
	}
	den=n;
	buf1=gcd(num,den);
	num/=buf1;
	den/=buf1;
	printf("%lld %lld\n",num,den);
	return 0;
}


#include <bits/stdc++.h>

using namespace std;

typedef long long LL;

const int nmax = 100007; const LL inf = 1e18;

LL sum[nmax],sol,N,sud[nmax],a[nmax];

inline LL gcd(LL a, LL b){
 LL r;
 while(b){
   r = a%b;
   a = b;
   b = r;
 }
   return a;
}

int main(){
   #ifndef GLOBAL_JUDGE
      freopen("txt.in","r",stdin);
      freopen("txt.out","w",stdout);
   #endif // GLOBAL_JUDGE
     LL i,j;
     cin >> N;
     for(i = 1; i <= N; ++i)
      cin >> a[i], sum[i] = sum[i-1] + a[i];
      for(i = N; i; --i)
         sud[i] = sud[i+1]+a[i];

      for(i = 1; i <= N; ++i){
         sol+=(N-1)*(i*a[i] - sum[i-1]);
         sol+=(N-1)*(sud[i+1]-(N-i)*a[i]);
      }
      N*=2;
    i = gcd(sol,N);

   cout << sol/i <<' ' <<N/i<<'\n' ;
  return 0;
}


#include <bits/stdc++.h>

using namespace std;

typedef long long LL;

const int nmax = 100007; const LL inf = 1e18;

LL sum[nmax],sol,N,sud[nmax],a[nmax];

inline LL gcd(LL a, LL b){
 LL r;
 while(b){
   r = a%b;
   a = b;
   b = r;
 }
   return a;
}

int main(){
//   #ifndef GLOBAL_JUDGE
//      freopen("txt.in","r",stdin);
//      freopen("txt.out","w",stdout);
//   #endif // GLOBAL_JUDGE
     LL i,j;
     cin >> N;
     for(i = 1; i <= N; ++i)
         cin >> a[i];
     sort(a+1,a+N+1);
     for(i = 1; i <= N; ++i)
      sum[i] = sum[i-1] + a[i];
      for(i = N; i; --i)
         sud[i] = sud[i+1]+a[i];

      for(i = 1; i <= N; ++i){
         sol+=2*(i*a[i] - sum[i-1]);
         sol+=2*(sud[i+1]-(N-i)*a[i]);
      }
      N*=2;
    i = gcd(sol,N);

   cout << sol/i <<' ' <<N/i<<'\n' ;
  return 0;
}


#include <stdio.h>
#include <algorithm>
#define ll long long

using namespace std;

int x[100010];

ll gcd(ll A, ll B) {
    if (B == 0)
        return A;
    return gcd(B, A % B);
}

int main() {
    int n;
    ll sum1 = 0, sum2 = 0, sumBefore = 0, sumtot = 0;
    scanf("%d", &n);
    for (int i = 1; i <= n; ++i) {
        scanf("%d", &x[i]);
        sum1 += x[i];
    }
    sort(x + 1, x + n + 1);
    for (int i = 1; i <= n; ++i) {
        sum2 += 1LL * x[i] * (i - 1) - sumBefore;
        sumBefore += x[i];
    }
    sumtot = sum1 + 2 * sum2;
    ll _gcd = gcd(sumtot, n);
    printf("%I64d %I64d", sumtot / _gcd, n / _gcd);
    return 0;
}


#include <cstdio>
#include <algorithm>
using namespace std;

typedef long long ll;
typedef pair <ll, ll> ii;

ll gcd(ll x, ll y) { return x? gcd(y % x, x): y; }

ii Norm(ii p)
{
	ll g = gcd(p.first, p.second);
	return ii(p.first / g, p.second / g);
}

ii Mult(ii a, ii b)
{
	a = Norm(a), b = Norm(b);
	ii ma = Norm(ii(a.first, b.second)), mb = Norm(ii(b.first, a.second));
	ii c = ii(ma.first * mb.first, ma.second * mb.second);
	return Norm(c);
}

ii Add(ii a, ii b)
{
	a = Norm(a), b = Norm(b);
	ll lcm = a.second / gcd(a.second, b.second) * b.second;
	ii c = ii(lcm / a.second * a.first + lcm / b.second * b.first, lcm);
	return Norm(c);
}

const int Maxn = 100005;

int n;
int a[Maxn];
ii res = ii(0, 1);

int main()
{
	scanf("%d", &n);
	for (int i = 0; i < n; i++)
		scanf("%d", &a[i]);
	sort(a, a + n);
	for (int i = 0; i < n; i++) {
		ii has = ii(n - i, n);
		ii add = Mult(ii(ll(i) * ll(n - i), 1), ii(2, n));
		has = Add(has, add);
		has = Mult(has, ii(a[i] - (i? a[i - 1]: 0), 1));
		res = Add(res, has);
	}
	printf("%I64d %I64d\n", res);
	return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define sz(a) (int)((a).size())
#define all(a) (a).begin(), (a).end()
using ll = long long;

int main() {
    ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
    //freopen("in.txt", "r", stdin);
    ll n; cin >> n;
    ll p = 0, q = n * (n - 1);
    for(ll i = 0; i < n; i++) {
        ll x; cin >> x;
        p += x * (i * (2 * i + 1) - (n - 1 - i) * (2 * n - 3 - 2 * i));
    }
    ll g = __gcd(p, q);
    p /= g; q /= g;
    cout << p << ' ' << q;
}


#include <bits/stdc++.h>
using namespace std;
#define sz(a) (int)((a).size())
#define all(a) (a).begin(), (a).end()
using ll = long long;

int main() {
    ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
    //freopen("in.txt", "r", stdin);
    ll n; cin >> n;
    vector<ll> a(n);
    for(int i = 0; i < n; i++) cin >> a[i];
    sort(all(a));
    ll p = 0, q = n;
    for(ll i = 0; i < n; i++) {
        p += (3 - 2 * n + 4 * i) * a[i];
    }
    ll g = __gcd(p, q);
    p /= g; q /= g;
    cout << p << ' ' << q;
}


#include <bits/stdc++.h>
using namespace std;
#define sz(a) (int)((a).size())
#define all(a) (a).begin(), (a).end()
using ll = long long;

int main() {
    ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
    //freopen("in.txt", "r", stdin);
    ll n; cin >> n;
    ll p = 0, q = n;
    for(ll i = 0; i < n; i++) {
        ll x; cin >> x;
        p += (3 - 2 * n + 4 * i) * x;
    }
    ll g = __gcd(p, q);
    p /= g; q /= g;
    cout << p << ' ' << q;
}


#include<bits/stdc++.h>
#define ll long long
#define f(i,n) for(int i=0;i<n;i++)
#define fr(i,a,b) for(int i=a;i<b;i++)
#define F first
#define S second
#define mp make_pair
#define pb push_back
using namespace std;

void test(){
	ll n;
	cin>>n;
	ll a[n];
	f(i,n)cin>>a[i];
	sort(a,a+n);
	ll prefix[n+1];
	prefix[0] = 0;
	f(i,n)prefix[i+1] = prefix[i] + a[i];

	ll sum = 0;
	for(ll i=1;i<=n;i++){
		ll bf = i-1;
		ll bs = prefix[i-1];
		ll me = bf*a[i-1];
		sum = sum + (me-bs);
	}
	sum = sum*2;
	f(i,n)sum+=a[i];
	ll num = sum;
	ll den = n;
	ll g = __gcd(num,den);
	num = num/g;
	den = den/g;
	cout<<num<<" "<<den<<"\n";
}

int main(){
//	std::ios::sync_with_stdio(false);
//	cin.tie(0);
//	cout.tie(0);
	int t=1;
//	cin>>t;
	while(t--){
		test();
	}
}


#include <bits/stdc++.h>
using namespace std;

typedef long long ll;

ll gcd(ll a, ll b) {
	while (a) {
		ll t = a;
		a = b % a;
		b = t;
	}
	return b;
}

int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(nullptr);
	cout.tie(nullptr);
	cerr.tie(nullptr);

	int n;
	cin >> n;
	vector<int> a(n);
	for (int& x : a) {
		cin >> x;
	}
	sort(a.begin(), a.end());
	ll gore = a[0];
	for (int i=1; i<n; i++) {
		gore += a[i];
		gore += (a[i] - a[i-1]) * i * 2ll * (n - i);
	}
	ll g = gcd(gore, n);
	cout << gore/g << ' ' << n/g << '\n';
}


import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.ArrayList;
import java.io.BufferedReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.io.Writer;
import java.util.StringTokenizer;
import java.math.BigInteger;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Parser in = new Parser(inputStream);
        OutputWriter out = new OutputWriter(outputStream);
        TaskA solver = new TaskA();
        solver.solve(1, in, out);
        out.close();
    }
}

class TaskA {
    public void solve(int testNumber, Parser in, OutputWriter out) {
        int n = in.nextInt();
        long[] dist = in.readLongArray(n);

        Arrays.sort(dist);

        long num = 0;
        for (int i = 0; i < n; i++) {
            //out.println(i + " " + dist[i] + " " + (dist[i]*2*i*(i-1) - dist[i]*2*(n-i-1)*(n-i-2)) + " " + ((n-2) * (dist[i] * i - dist[i] * (n-i-1))));
            num += dist[i]*2*(i)*(i-1) - dist[i]*2*(n-i-1)*(n-i-2);
            num += (n-2) * (dist[i] * i - dist[i] * (n-i-1));
            num += (n-2) * (dist[i] * 2 * i);
        }

        long den = n;
        den *= (n-1);

        long g = MathUtils.gcd(num, den);
        out.println(num/g + " " + den/g);
    }
}

class Parser
{
    private BufferedReader din;
    private StringTokenizer tokenizer;

    public Parser(InputStream in)
    {
        din = new BufferedReader(new InputStreamReader(in));
        tokenizer = null;
    }

    public String next() {
        while (tokenizer == null || !tokenizer.hasMoreTokens()) {
            try {
                tokenizer = new StringTokenizer(din.readLine());
            } catch (Exception e) {
                throw new UnknownError();
            }
        }
        return tokenizer.nextToken();
    }

    public int nextInt()
    {
        return Integer.parseInt(next());
    }

    public long nextLong()
    {
        return Long.parseLong(next());
    }

    public long[] readLongArray(int n) {
        long[] ret = new long[n];
        for (int i = 0; i < n; i++) ret[i] = nextLong();
        return ret;
    }
}

class OutputWriter extends PrintWriter {
    public OutputWriter(Writer out) {
        super(out);
    }

    public OutputWriter(OutputStream out) {
        super(out);
    }

    }

class MathUtils {
    public static long gcd(long a, long b) {
        while (b != 0) {
            long t = b;
            b = a%b;
            a = t;
        }
        return a;
    }

    }


import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.ArrayList;
import java.io.BufferedReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.io.Writer;
import java.util.StringTokenizer;
import java.math.BigInteger;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Parser in = new Parser(inputStream);
        OutputWriter out = new OutputWriter(outputStream);
        TaskA solver = new TaskA();
        solver.solve(1, in, out);
        out.close();
    }
}

class TaskA {
    public void solve(int testNumber, Parser in, OutputWriter out) {
        long n = in.nextInt();
        long[] dist = in.readLongArray((int) n);

        Arrays.sort(dist);

        long num = 0;
        for (int i = 0; i < n; i++) {
            //out.println(i + " " + dist[i] + " " + (dist[i]*2*i*(i-1) - dist[i]*2*(n-i-1)*(n-i-2)) + " " + ((n-2) * (dist[i] * i - dist[i] * (n-i-1))));
            num += dist[i]*2*(i)*(i-1) - dist[i]*2*(n-i-1)*(n-i-2);
            num += Math.max(n-2, 1) * (dist[i] * i - dist[i] * (n-i-1));
            num += Math.max(n-2, 1) * (dist[i] * 2 * i);
        }

        long den = ((n-1) * (n-2)) + 2 * Math.max(1, n-2) * (n-1);

        long g = MathUtils.gcd(num, den);
        out.println(num/g + " " + den/g);
    }
}

class Parser
{
    private BufferedReader din;
    private StringTokenizer tokenizer;

    public Parser(InputStream in)
    {
        din = new BufferedReader(new InputStreamReader(in));
        tokenizer = null;
    }

    public String next() {
        while (tokenizer == null || !tokenizer.hasMoreTokens()) {
            try {
                tokenizer = new StringTokenizer(din.readLine());
            } catch (Exception e) {
                throw new UnknownError();
            }
        }
        return tokenizer.nextToken();
    }

    public int nextInt()
    {
        return Integer.parseInt(next());
    }

    public long nextLong()
    {
        return Long.parseLong(next());
    }

    public long[] readLongArray(int n) {
        long[] ret = new long[n];
        for (int i = 0; i < n; i++) ret[i] = nextLong();
        return ret;
    }
}

class OutputWriter extends PrintWriter {
    public OutputWriter(Writer out) {
        super(out);
    }

    public OutputWriter(OutputStream out) {
        super(out);
    }

    }

class MathUtils {
    public static long gcd(long a, long b) {
        while (b != 0) {
            long t = b;
            b = a%b;
            a = t;
        }
        return a;
    }

    }


import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.ArrayList;
import java.io.BufferedReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.io.Writer;
import java.util.StringTokenizer;
import java.math.BigInteger;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Parser in = new Parser(inputStream);
        OutputWriter out = new OutputWriter(outputStream);
        TaskA solver = new TaskA();
        solver.solve(1, in, out);
        out.close();
    }
}

class TaskA {
    public void solve(int testNumber, Parser in, OutputWriter out) {
        long n = in.nextInt();
        long[] dist = in.readLongArray((int) n);

        Arrays.sort(dist);

        long num = 0;
        for (int i = 0; i < n; i++) {
            //out.println(i + " " + dist[i] + " " + (dist[i]*2*i*(i-1) - dist[i]*2*(n-i-1)*(n-i-2)) + " " + ((n-2) * (dist[i] * i - dist[i] * (n-i-1))));
            num += dist[i]*2*(i)*(i-1) - dist[i]*2*(n-i-1)*(n-i-2);
            num += (dist[i] * i - dist[i] * (n-i-1));
            num += (dist[i] * 2 * i);
        }

        long den = ((n-1) * n);

        long g = MathUtils.gcd(num, den);
        out.println(num/g + " " + den/g);
    }
}

class Parser
{
    private BufferedReader din;
    private StringTokenizer tokenizer;

    public Parser(InputStream in)
    {
        din = new BufferedReader(new InputStreamReader(in));
        tokenizer = null;
    }

    public String next() {
        while (tokenizer == null || !tokenizer.hasMoreTokens()) {
            try {
                tokenizer = new StringTokenizer(din.readLine());
            } catch (Exception e) {
                throw new UnknownError();
            }
        }
        return tokenizer.nextToken();
    }

    public int nextInt()
    {
        return Integer.parseInt(next());
    }

    public long nextLong()
    {
        return Long.parseLong(next());
    }

    public long[] readLongArray(int n) {
        long[] ret = new long[n];
        for (int i = 0; i < n; i++) ret[i] = nextLong();
        return ret;
    }
}

class OutputWriter extends PrintWriter {
    public OutputWriter(Writer out) {
        super(out);
    }

    public OutputWriter(OutputStream out) {
        super(out);
    }

    }

class MathUtils {
    public static long gcd(long a, long b) {
        while (b != 0) {
            long t = b;
            b = a%b;
            a = t;
        }
        return a;
    }

    }


import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.io.BufferedReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.io.Writer;
import java.util.StringTokenizer;
import java.math.BigInteger;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Parser in = new Parser(inputStream);
        OutputWriter out = new OutputWriter(outputStream);
        TaskA solver = new TaskA();
        solver.solve(1, in, out);
        out.close();
    }
}

class TaskA {
    public void solve(int testNumber, Parser in, OutputWriter out) {
        long n = in.nextInt();
        long[] dist = in.readLongArray((int) n);

        Arrays.sort(dist);

        BigInteger num = BigInteger.ZERO;
        for (int i = 0; i < n; i++) {
            //out.println(i + " " + dist[i] + " " + (dist[i]*2*i*(i-1) - dist[i]*2*(n-i-1)*(n-i-2)) + " " + ((n-2) * (dist[i] * i - dist[i] * (n-i-1))));
            num = num.add( BigInteger.valueOf( dist[i]*2*(i)*(i-1) - dist[i]*2*(n-i-1)*(n-i-2) ) );
            num = num.add( BigInteger.valueOf( dist[i] * i - dist[i] * (n-i-1) ) );
            num = num.add( BigInteger.valueOf( dist[i] * 2 * i ));
        }

        BigInteger den = BigInteger.valueOf((n-1) * n);

        BigInteger g = num.gcd(den);
        out.println(num.divide(g) + " " + den.divide(g));
    }
}

class Parser
{
    private BufferedReader din;
    private StringTokenizer tokenizer;

    public Parser(InputStream in)
    {
        din = new BufferedReader(new InputStreamReader(in));
        tokenizer = null;
    }

    public String next() {
        while (tokenizer == null || !tokenizer.hasMoreTokens()) {
            try {
                tokenizer = new StringTokenizer(din.readLine());
            } catch (Exception e) {
                throw new UnknownError();
            }
        }
        return tokenizer.nextToken();
    }

    public int nextInt()
    {
        return Integer.parseInt(next());
    }

    public long nextLong()
    {
        return Long.parseLong(next());
    }

    public long[] readLongArray(int n) {
        long[] ret = new long[n];
        for (int i = 0; i < n; i++) ret[i] = nextLong();
        return ret;
    }
}

class OutputWriter extends PrintWriter {
    public OutputWriter(Writer out) {
        super(out);
    }

    public OutputWriter(OutputStream out) {
        super(out);
    }

    }


import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.ArrayList;
import java.io.BufferedReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.io.Writer;
import java.util.StringTokenizer;
import java.math.BigInteger;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Parser in = new Parser(inputStream);
        OutputWriter out = new OutputWriter(outputStream);
        TaskA solver = new TaskA();
        solver.solve(1, in, out);
        out.close();
    }
}

class TaskA {
    public void solve(int testNumber, Parser in, OutputWriter out) {
        int n = in.nextInt();
        long[] dist = in.readLongArray(n);

        Arrays.sort(dist);

        long num = 0;
        for (int i = 0; i < n; i++) {
            //out.println(i + " " + dist[i] + " " + (dist[i]*2*i*(i-1) - dist[i]*2*(n-i-1)*(n-i-2)) + " " + ((n-2) * (dist[i] * i - dist[i] * (n-i-1))));
            num += dist[i]*2*(i)*(i-1) - dist[i]*2*(n-i-1)*(n-i-2);
            num += Math.max(n-2, 1) * (dist[i] * i - dist[i] * (n-i-1));
            num += Math.max(n-2, 1) * (dist[i] * 2 * i);
        }

        long den = n;
        den *= (n-1);

        long g = MathUtils.gcd(num, den);
        out.println(num/g + " " + den/g);
    }
}

class Parser
{
    private BufferedReader din;
    private StringTokenizer tokenizer;

    public Parser(InputStream in)
    {
        din = new BufferedReader(new InputStreamReader(in));
        tokenizer = null;
    }

    public String next() {
        while (tokenizer == null || !tokenizer.hasMoreTokens()) {
            try {
                tokenizer = new StringTokenizer(din.readLine());
            } catch (Exception e) {
                throw new UnknownError();
            }
        }
        return tokenizer.nextToken();
    }

    public int nextInt()
    {
        return Integer.parseInt(next());
    }

    public long nextLong()
    {
        return Long.parseLong(next());
    }

    public long[] readLongArray(int n) {
        long[] ret = new long[n];
        for (int i = 0; i < n; i++) ret[i] = nextLong();
        return ret;
    }
}

class OutputWriter extends PrintWriter {
    public OutputWriter(Writer out) {
        super(out);
    }

    public OutputWriter(OutputStream out) {
        super(out);
    }

    }

class MathUtils {
    public static long gcd(long a, long b) {
        while (b != 0) {
            long t = b;
            b = a%b;
            a = t;
        }
        return a;
    }

    }


import javax.swing.*;
import java.io.*;
import java.math.BigInteger;
import java.util.*;

public class CodeForces {
    static boolean ONLINE_JUDGE = System.getProperty("ONLINE_JUDGE") != null;

    void runCase(int caseNum) throws IOException {
        int n = nextInt();
        long[] distance = new long[n];
        long sum = 0;
        for (int i = 0; i < n; ++i) {
            distance[i] = nextLong();
            sum += distance[i];
        }
        long leftSum = 0;
        long rightSum = sum - n * distance[0];
        sum += rightSum;
        for (int i = 1; i < n; ++i) {
            leftSum += i * (distance[i] - distance[i - 1]);
            rightSum -= (n - i) * (distance[i] - distance[i - 1]);
            sum += leftSum + rightSum;
        }
        BigInteger d = BigInteger.valueOf(sum);
        BigInteger r = BigInteger.valueOf(n);
        BigInteger g = d.gcd(r);
        d = d.divide(g);
        r = r.divide(g);
        System.out.println(d.toString() + " " + r.toString());
    }

    public static void main(String[] args) throws IOException {
        if (ONLINE_JUDGE){
            in = new BufferedReader(new InputStreamReader(System.in));
            out = new PrintWriter(System.out);
        }else{
            in = new BufferedReader(new FileReader("input.txt"));
            out = new PrintWriter("output.txt");
        }
        new CodeForces().runIt();
        out.flush();
        out.close();
        return;
    }

    static BufferedReader in;
    private StringTokenizer st;
    static PrintWriter out;

    String next() throws IOException {
        while (!st.hasMoreTokens()) {
            String line = in.readLine();
            if (line == null) {
                return null;
            }
            st = new StringTokenizer(line, " ");
        }
        return st.nextToken();
    }

    int nextInt() throws IOException {
        return Integer.parseInt(next());
    }

    double nextDouble() throws IOException {
        return Double.parseDouble(next());
    }

    long nextLong() throws IOException {
        return Long.parseLong(next());
    }

    void runIt() throws IOException {
        st = new StringTokenizer("");

//        int N = nextInt();
//        for (int i = 0; i < N; i++) {
//            runCase(i + 1);
//        }
        runCase(0);

        out.flush();
    }

}


import javax.swing.*;
import java.io.*;
import java.math.BigInteger;
import java.util.*;

public class CodeForces {
    static boolean ONLINE_JUDGE = System.getProperty("ONLINE_JUDGE") != null;

    void runCase(int caseNum) throws IOException {
        int n = nextInt();
        long[] distance = new long[n];
        long sum = 0;
        for (int i = 0; i < n; ++i) {
            distance[i] = nextLong();
            sum += distance[i];
        }
        Arrays.sort(distance);
        long leftsum = 0;
        long rightSum = sum - n * distance[0];
        sum += rightSum;
        for (int i = 1; i < n; ++i) {
            leftsum += i * (distance[i] - distance[i - 1]);
            rightSum -= (n - i) * (distance[i] - distance[i - 1]);
            sum += leftsum + rightSum;
        }
        BigInteger d = BigInteger.valueOf(sum);
        BigInteger r = BigInteger.valueOf(n);
        BigInteger g = d.gcd(r);
        d = d.divide(g);
        r = r.divide(g);
        System.out.println(d.toString() + " " + r.toString());
    }

    public static void main(String[] args) throws IOException {
        if (ONLINE_JUDGE){
            in = new BufferedReader(new InputStreamReader(System.in));
            out = new PrintWriter(System.out);
        }else{
            in = new BufferedReader(new FileReader("input.txt"));
            out = new PrintWriter("output.txt");
        }
        new CodeForces().runIt();
        out.flush();
        out.close();
        return;
    }

    static BufferedReader in;
    private StringTokenizer st;
    static PrintWriter out;

    String next() throws IOException {
        while (!st.hasMoreTokens()) {
            String line = in.readLine();
            if (line == null) {
                return null;
            }
            st = new StringTokenizer(line, " ");
        }
        return st.nextToken();
    }

    int nextInt() throws IOException {
        return Integer.parseInt(next());
    }

    double nextDouble() throws IOException {
        return Double.parseDouble(next());
    }

    long nextLong() throws IOException {
        return Long.parseLong(next());
    }

    void runIt() throws IOException {
        st = new StringTokenizer("");

//        int N = nextInt();
//        for (int i = 0; i < N; i++) {
//            runCase(i + 1);
//        }
        runCase(0);

        out.flush();
    }

}


import javax.swing.*;
import java.io.*;
import java.math.BigInteger;
import java.util.*;

public class CodeForces {
    static boolean ONLINE_JUDGE = System.getProperty("ONLINE_JUDGE") != null;

    void runCase(int caseNum) throws IOException {
        int n = nextInt();
        long[] distance = new long[n];
        long sum = 0;
        for (int i = 0; i < n; ++i) {
            distance[i] = nextLong();
            sum += distance[i];
        }

        for (int i = 0; i < n; ++i) {
            for (int j = 0; j < n; ++j) {
                sum += Math.abs(distance[i] - distance[j]);
            }
        }
        BigInteger d = BigInteger.valueOf(sum);
        BigInteger r = BigInteger.valueOf(n);
        BigInteger g = d.gcd(r);
        d = d.divide(g);
        r = r.divide(g);
        System.out.println(d.toString() + " " + r.toString());
    }

    public static void main(String[] args) throws IOException {
        if (ONLINE_JUDGE){
            in = new BufferedReader(new InputStreamReader(System.in));
            out = new PrintWriter(System.out);
        }else{
            in = new BufferedReader(new FileReader("input.txt"));
            out = new PrintWriter("output.txt");
        }
        new CodeForces().runIt();
        out.flush();
        out.close();
        return;
    }

    static BufferedReader in;
    private StringTokenizer st;
    static PrintWriter out;

    String next() throws IOException {
        while (!st.hasMoreTokens()) {
            String line = in.readLine();
            if (line == null) {
                return null;
            }
            st = new StringTokenizer(line, " ");
        }
        return st.nextToken();
    }

    int nextInt() throws IOException {
        return Integer.parseInt(next());
    }

    double nextDouble() throws IOException {
        return Double.parseDouble(next());
    }

    long nextLong() throws IOException {
        return Long.parseLong(next());
    }

    void runIt() throws IOException {
        st = new StringTokenizer("");

//        int N = nextInt();
//        for (int i = 0; i < N; i++) {
//            runCase(i + 1);
//        }
        runCase(0);

        out.flush();
    }

}


import java.io.*;
import java.math.BigInteger;
import java.util.*;
import static java.util.Arrays.*;

public class A {
    private static final int mod = (int)1e9+9;

    final IOFast io = new IOFast();

    static long gcd(long n, long r) { return r == 0 ? n : gcd(r, n % r); }
    public void run() throws IOException {
        int n = io.nextInt();
        int[] xs = new int[n];
        long s = 0;

        for(int i = 0; i < n; i++) {
            xs[i] = io.nextInt();
            s += xs[i];
        }

        Arrays.sort(xs);
        long sum = 0;
        long ans = 0;
        for(int i = 0; i < n; i++) {
            long v = xs[i] * (long)i - sum;
            ans += v + (s - sum - xs[i] * (long)(n-i)) + xs[i];
            sum += xs[i];
        }
        final long g = gcd(ans, n);
        io.out.println(ans/g + " " + n/g);
    }

    void main() throws IOException {
        //      IOFast.setFileIO("rle-size.in", "rle-size.out");
        try {
            run();
        }
        catch (EndOfFileRuntimeException e) { }
        io.out.flush();
    }

    public static void main(String[] args) throws IOException {
        new A().main();
    }

    static class EndOfFileRuntimeException extends RuntimeException {
        private static final long serialVersionUID = -8565341110209207657L; }

    static
    public class IOFast {
        private BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
        private PrintWriter out = new PrintWriter(System.out);

        void setFileIO(String ins, String outs) throws IOException {
            in = new BufferedReader(new FileReader(ins));
            out = new PrintWriter(new FileWriter(outs));
        }

        //      private static final int BUFFER_SIZE = 50 * 200000;
        private static int pos, readLen;
        private static final char[] buffer = new char[1024 * 8];
        private static final char[] str = new char[500000*8*2];
        private static boolean[] isDigit = new boolean[256];
        private static boolean[] isSpace = new boolean[256];
        private static boolean[] isLineSep = new boolean[256];

        static {
            for(int i = 0; i < 10; i++) { isDigit['0' + i] = true; }
            isDigit['-'] = true;
            isSpace[' '] = isSpace['\r'] = isSpace['\n'] = isSpace['\t'] = true;
            isLineSep['\r'] = isLineSep['\n'] = true;
        }

        public int read() throws IOException {
            if(pos >= readLen) {
                pos = 0;
                readLen = in.read(buffer);
                if(readLen <= 0) { throw new EndOfFileRuntimeException(); }
            }
            return buffer[pos++];
        }

        public int nextInt() throws IOException {
            return Integer.parseInt(nextString());
        }

        public long nextLong() throws IOException {
            return Long.parseLong(nextString());
        }

        public char nextChar() throws IOException {
            while(true) {
                final int c = read();
                if(!isSpace[c]) { return (char)c; }
            }
        }

        int reads(char[] cs, int len, boolean[] accept) throws IOException {
            try {
                while(true) {
                    final int c = read();
                    if(accept[c]) { break; }
                    str[len++] = (char)c;
                }
            }
            catch(EndOfFileRuntimeException e) { ; }

            return len;
        }

        public char[] nextLine() throws IOException {
            int len = 0;
            str[len++] = nextChar();
            len = reads(str, len, isLineSep);

            try {
                if(str[len-1] == '\r') { len--; read(); }
            }
            catch(EndOfFileRuntimeException e) { ; }

            return Arrays.copyOf(str, len);
        }

        public String nextString() throws IOException {
            return new String(next());
        }

        public char[] next() throws IOException {
            int len = 0;
            str[len++] = nextChar();
            len = reads(str, len, isSpace);
            return Arrays.copyOf(str, len);
        }

        public double nextDouble() throws IOException {
            return Double.parseDouble(nextString());
        }

    }

}


import java.io.*;
import java.lang.reflect.Array;
import java.math.BigInteger;
import java.util.Arrays;
import java.util.Scanner;
import java.util.StringTokenizer;
import java.util.TreeMap;

public class A
{
	public static void main(String [] args) throws IOException
	{
		BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));

		StringTokenizer tokenizer = new StringTokenizer(reader.readLine());
		int n = Integer.parseInt(tokenizer.nextToken());
		long [] array = new long[n];
		tokenizer = new StringTokenizer(reader.readLine());

		for(int i = 0 ; i < n ; i++)
			array[i] = Integer.parseInt(tokenizer.nextToken());

		long [] diff = new long[n-1];
		for(int i = 0 ; i < n-1 ; i++)
			diff[i] = (long)(n-i-1)*(2*(i+1));
		long sum = 0;
		for(int i = 0 ; i < n ; i++)
			sum += array[i];
		Arrays.sort(array);
		for(int i = 0 ; i < n-1 ; i++)
			sum += diff[i]*(array[i+1]-array[i]);

		BigInteger a = new BigInteger(sum+"");
		BigInteger b = new BigInteger(n+"");
		BigInteger g = a.gcd(b);
		a = a.divide(g);
		b = b.divide(g);

		System.out.println(a+" "+b);
	}

}


import java.io.*;
import java.math.BigInteger;
import java.util.*;

public class CF {

	MyScanner in;
	PrintWriter out;

	long gcd(long x, long y) {
		return x == 0 ? y : gcd(y % x, x);
	}

	class Rational {
		BigInteger x, y;

		Rational(long x, long y) {
			this.x = BigInteger.valueOf(x);
			this.y = BigInteger.valueOf(y);
			BigInteger g = this.x.gcd(this.y);
			this.x = this.x.divide(g);
			this.y = this.y.divide(g);
		}

		public Rational(BigInteger x, BigInteger y) {
			this.x = x;
			this.y = y;
			BigInteger g = this.x.gcd(this.y);
			this.x = this.x.divide(g);
			this.y = this.y.divide(g);
		}
	}

	Rational sum(Rational x, Rational y) {
		return new Rational(x.x .multiply(y.y).add(y.x .multiply(x.y)), x.y.multiply(y.y));
	}

	void solve() {
		int n = in.nextInt();
		int[] a = new int[n];
		for (int i = 0; i < n; i++) {
			a[i] = in.nextInt();
		}
		Random rnd = new Random(123);
		for (int i = 1; i < n; i++) {
			int x = rnd.nextInt(i);
			int tmp = a[x];
			a[x] = a[i];
			a[i] = tmp;
		}
		Arrays.sort(a);
		long up = 0;
		long sum = 0;
		for (int i = 0; i < n; i++) {
			up += a[i] * 1L * i - sum;
			sum += a[i];
		}
		up *= 2;
		long down = n;
		long g = gcd(up, down);
		up /= g;
		down /= g;
		Rational a1 = new Rational(up, down);
		long ss = 0;
		for (int i = 0; i <n ; i++) {
			ss += a[i];
		}
		Rational a2 = new Rational(ss, n);
		Rational res = sum(a2, a1);
		out.println(res.x + " " + res.y);
	}

	void run() {
		try {
			in = new MyScanner();
			out = new PrintWriter(System.out);

			solve();

			out.close();
		} catch (Exception e) {
			e.printStackTrace();
			System.exit(1);
		}
	}

	class MyScanner {
		BufferedReader in;
		StringTokenizer st;

		public MyScanner() {
			in = new BufferedReader(new InputStreamReader(System.in));

		}

		String nextToken() {
			while (st == null || !st.hasMoreElements()) {
				try {
					st = new StringTokenizer(in.readLine());
				} catch (IOException e) {
					e.printStackTrace();
				}
			}
			return st.nextToken();
		}

		int nextInt() {
			return Integer.parseInt(nextToken());
		}

		long nextLong() {
			return Long.parseLong(nextToken());
		}

		double nextDouble() {
			return Double.parseDouble(nextToken());
		}
	}

	public static void main(String[] args) {
		new CF().run();
	}
}


import java.util.List;
import java.io.IOException;
import java.io.OutputStreamWriter;
import java.io.BufferedWriter;
import java.util.InputMismatchException;
import java.util.ArrayList;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.Random;
import java.io.Writer;
import java.math.BigInteger;
import java.util.Collections;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        OutputWriter out = new OutputWriter(outputStream);
        TaskA solver = new TaskA();
        solver.solve(1, in, out);
        out.close();
    }
}

class TaskA {
    public void solve(int testNumber, InputReader in, OutputWriter out) {
        int n = in.nextInt();
        ArrayList<Integer> a = new ArrayList<Integer>();
        long seed = 57;
        for (int i = 0; i < n; ++i) {
            int x = in.nextInt();
            a.add(x);
            seed = seed * 43L + (long) x;
        }
        Collections.shuffle(a, new Random(seed));
        Collections.sort(a);
        long res = 0;
        long sum = 0;
        long ind = 1;
        for (int _x : a) {
            long x = _x;
            res += ind * x - sum;
            ind += 2;
            sum += 2 * x;
        }
        long den = n;
        long d = BigInteger.valueOf(res).gcd(BigInteger.valueOf(den)).longValue();
        den /= d;
        res /= d;
        out.printLine(res + " " + den);
    }
}

class InputReader {
    private InputStream stream;
    private byte[] buffer = new byte[10000];
    private int cur;
    private int count;

    public InputReader(InputStream stream) {
        this.stream = stream;
    }

    public static boolean isSpace(int c) {
        return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
    }

    public int read() {
        if (count == -1) {
            throw new InputMismatchException();
        }
        try {
            if (cur >= count) {
                cur = 0;
                count = stream.read(buffer);
                if (count <= 0)
                    return -1;
            }
        } catch (IOException e) {
            throw new InputMismatchException();
        }
        return buffer[cur++];
    }

    public int readSkipSpace() {
        int c;
        do {
            c = read();
        } while (isSpace(c));
        return c;
    }

    public int nextInt() {
        int sgn = 1;
        int c = readSkipSpace();
        if (c == '-') {
            sgn = -1;
            c = read();
        }
        int res = 0;
        do {
            if (c < '0' || c > '9') {
                throw new InputMismatchException();
            }
            res = res * 10 + c - '0';
            c = read();
        } while (!isSpace(c));
        res *= sgn;
        return res;
    }

    }

class OutputWriter {
    private final PrintWriter writer;

    public OutputWriter(OutputStream outputStream) {
        writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(outputStream)));
    }

    public OutputWriter(Writer writer) {
        this.writer = new PrintWriter(writer);
    }

    public void print(Object... objects) {
        for (int i = 0; i < objects.length; i++) {
            if (i != 0) {
                writer.print(' ');
            }
            writer.print(objects[i]);
        }
    }

    public void printLine(Object... objects) {
        print(objects);
        writer.println();
    }

    public void close() {
        writer.close();
    }

    }


import java.io.*;
import java.util.*;

public class cf341a {
  public static void main(String[] args) {
    FastIO in = new FastIO(), out = in;
    int n = in.nextInt();
    Long[] v = new Long[n];
    for(int i=0; i<n; i++) v[i] = in.nextLong();
    Arrays.sort(v);
    long num = 0;
    for(long x : v) num += x;
    long sumAbove = num, sumBelow = 0;
    for(int i=0; i<n; i++) {
      sumAbove -= v[i];

      long numAbove = n-i-1;
      long numBelow = i;
      num += sumAbove - numAbove*v[i];
      num += numBelow*v[i] - sumBelow;

      sumBelow += v[i];
    }
    long den = n;
    long g = gcd(num,den);
    num /= g; den /= g;
    out.println(num + " " + den);
    out.close();
  }
  static long gcd(long a, long b) {
    return b==0?a:gcd(b,a%b);
  }

  static class FastIO extends PrintWriter {
    BufferedReader br;
    StringTokenizer st;

    public FastIO() {
      this(System.in, System.out);
    }

    public FastIO(InputStream in, OutputStream out) {
      super(new BufferedWriter(new OutputStreamWriter(out)));
      br = new BufferedReader(new InputStreamReader(in));
      scanLine();
    }

    public void scanLine() {
      try {
        st = new StringTokenizer(br.readLine().trim());
      } catch (Exception e) {
        throw new RuntimeException(e.getMessage());
      }
    }

    public int numTokens() {
      if (!st.hasMoreTokens()) {
        scanLine();
        return numTokens();
      }
      return st.countTokens();
    }

    public String next() {
      if (!st.hasMoreTokens()) {
        scanLine();
        return next();
      }
      return st.nextToken();
    }

    public double nextDouble() {
      return Double.parseDouble(next());
    }

    public long nextLong() {
      return Long.parseLong(next());
    }

    public int nextInt() {
      return Integer.parseInt(next());
    }
  }
}


import java.io.*;
import java.lang.reflect.Array;
import java.math.BigDecimal;
import java.sql.Time;
import java.util.*;

import java.math.BigInteger;

import static java.lang.Math.*;
import static java.math.BigInteger.*;
import static java.util.Arrays.*;

public class Main{

    void run(){
        Locale.setDefault(Locale.US);
        boolean oj = System.getProperty("ONLINE_JUDGE") != null;
//        boolean oj = true;
        try{
            if( oj ){
                sc  = new FastScanner( new InputStreamReader(System.in  ) );
                out = new PrintWriter(   new OutputStreamWriter(System.out) );
            } else{
                sc  = new FastScanner(new FileReader("in.txt") );
//                sc  = new FastScanner(new FileReader("D:\\JavaOlymp\\FatalError\\output.txt") );
                out = new PrintWriter(   new FileWriter("out.txt") );
            }
        } catch (Exception e) {
            System.exit(-1);
        }
        long tB = System.currentTimeMillis();
        solve();
        if( !oj ) System.err.println( "Time: " + (System.currentTimeMillis()-tB)/1e3 );
        out.flush();
    }

    class FastScanner{
        BufferedReader br;
        StringTokenizer st = new StringTokenizer("");
        FastScanner( InputStreamReader a ){
            br = new BufferedReader(a);
        }
        FastScanner( FileReader a ){
            br = new BufferedReader(a);
        }
        String next(){
            while( !st.hasMoreTokens() )
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    return null;
                }
            return st.nextToken();
        }
        String readLine(){
            try {
                return br.readLine();
            } catch (Exception e) {
                return null;
            }
        }
        int nextInt(){ return Integer.parseInt(next()); }
        long nextLong(){ return Long.parseLong(next()); }
    }

    FastScanner sc;
    PrintWriter out;

    public static void main(String[] args){
        new Main().run();
//        new Thread( null, new Runnable() {
//            @Override
//            public void run() {
//                new Main().run();
//            }
//            }, "LOL", 256L * 1024 * 1024 / 2 ).run();
//        }, "LOL", 2000 * 1024 * 1024 ).run();
    }

    void TLE(){ for(;;); }

    void MLE(){
        int[][] adj = new int[1024*1024][];
        for( int i = 0; i < adj.length; ++i )
            adj[i] = new int[1024*1024];
    }

    void exit( int val ){
        out.flush();
        System.exit(val);
    }
    //////////////////////////////////////////////////////////////////////////////////////////

    long gcd(long a, long b) {
        return b == 0 ? a : gcd(b, a % b);
    }

    int n;
    Integer[] a;

    void solve(){
//        n = (int)1e5;
        n = sc.nextInt();
        a = new Integer[n];
        for( int i = 0; i < n; ++i ){
            a[i] = sc.nextInt();
        }
        sort(a);

        long u = 0;
        long sumPref = a[0];
        for( int i = 1; i < n; ++i ){
            u += ((long)i * a[i] - sumPref );
            //
            sumPref += a[i];
        }
        u *= 2;
        for( int i = 0; i < n; ++i ) u += a[i];

        long g = gcd( u, n );
        out.println( u / g +" "+ n / g );
    }

}


import java.io.*;
import java.lang.reflect.Array;
import java.math.BigDecimal;
import java.sql.Time;
import java.util.*;

import java.math.BigInteger;

import static java.lang.Math.*;
import static java.math.BigInteger.*;
import static java.util.Arrays.*;

public class Main{

    void run(){
        Locale.setDefault(Locale.US);
        boolean oj = System.getProperty("ONLINE_JUDGE") != null;
//        boolean oj = true;
        try{
            if( oj ){
                sc  = new FastScanner( new InputStreamReader(System.in  ) );
                out = new PrintWriter(   new OutputStreamWriter(System.out) );
            } else{
                sc  = new FastScanner(new FileReader("in.txt") );
//                sc  = new FastScanner(new FileReader("D:\\JavaOlymp\\FatalError\\output.txt") );
                out = new PrintWriter(   new FileWriter("out.txt") );
            }
        } catch (Exception e) {
            System.exit(-1);
        }
        long tB = System.currentTimeMillis();
        solve();
        if( !oj ) System.err.println( "Time: " + (System.currentTimeMillis()-tB)/1e3 );
        out.flush();
    }

    class FastScanner{
        BufferedReader br;
        StringTokenizer st = new StringTokenizer("");
        FastScanner( InputStreamReader a ){
            br = new BufferedReader(a);
        }
        FastScanner( FileReader a ){
            br = new BufferedReader(a);
        }
        String next(){
            while( !st.hasMoreTokens() )
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    return null;
                }
            return st.nextToken();
        }
        String readLine(){
            try {
                return br.readLine();
            } catch (Exception e) {
                return null;
            }
        }
        int nextInt(){ return Integer.parseInt(next()); }
        long nextLong(){ return Long.parseLong(next()); }
    }

    FastScanner sc;
    PrintWriter out;

    public static void main(String[] args){
        new Main().run();
//        new Thread( null, new Runnable() {
//            @Override
//            public void run() {
//                new Main().run();
//            }
//            }, "LOL", 256L * 1024 * 1024 / 2 ).run();
//        }, "LOL", 2000 * 1024 * 1024 ).run();
    }

    void TLE(){ for(;;); }

    void MLE(){
        int[][] adj = new int[1024*1024][];
        for( int i = 0; i < adj.length; ++i )
            adj[i] = new int[1024*1024];
    }

    void exit( int val ){
        out.flush();
        System.exit(val);
    }
    //////////////////////////////////////////////////////////////////////////////////////////

    long gcd( long a, long b ){
        return b==0? a : gcd( b, a%b );
    }

    int n;
    Integer[] a;

    void solve(){
//        n = (int)1e5;
        n = sc.nextInt();
        a = new Integer[n];
        for( int i = 0; i < n; ++i ){
            a[i] = sc.nextInt();
        }
        sort(a);

        long u = 0;
        long sumPref = a[0];
        for( int i = 1; i < n; ++i ){
            u += ((long)i * a[i] - sumPref );
            //
            sumPref += a[i];
        }
        u *= 2;
        for( int i = 0; i < n; ++i ) u += a[i];

        long g = gcd( u, n );
        out.printf("%d %d\n", u / g, n / g);
    }

}


import java.util.Scanner;
import java.io.PrintStream;
import java.io.BufferedReader;
import java.io.StreamTokenizer;
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 * @author KNIGHT0X300
 */
public class Main {
	public static void main(String[] args) {
		InputStream inputStream = System.in;
		OutputStream outputStream = System.out;
		InputStreamReader in = new InputStreamReader(inputStream);
		PrintWriter out = new PrintWriter(outputStream);
		TaskA solver = new TaskA();
		solver.solve(1, in, out);
		out.close();
	}
}

class TaskA {
    StreamTokenizer in;
    PrintWriter out;
    BufferedReader re;
    Scanner sc;
    public void solve (int testNumber, InputStreamReader in, PrintWriter out)  {

          this.in = new StreamTokenizer(new BufferedReader(in));
          this.re =  new BufferedReader(in);
          this.sc = new Scanner(in);
          this.out = out;
          try {
                      this.solve();
                  } catch (IOException e) {
                      e.printStackTrace();  //To change body of catch statement use File | Settings | File Templates.
                  }
          out.flush();

    }

         /////////////////////////////////////////////////////////////
     int nextInt() throws IOException
       {
          in.nextToken();
          return (int)in.nval;
       }

     void solve() throws IOException
       {
            int n=nextInt();
           long[] A = new  long[n];
           long[] sum = new  long[n];
           for (int i=0;i<n;i++){
               A[i]=nextInt();
               if(i==0)
               sum[i]=A[i];
               else
                   sum[i]=sum[i-1]+A[i];
           }
        long num=sum[n-1],den=n;
           for (int i=0;i<n-1;i++){
             num+=2*( (long)(i+1)*A[i+1]-sum[i]);

           }
           long gg=   gcd(num,den);
           num/=gg;den/=gg;
           out.println(num+" "+den);
         // do the sum
       }
    public static long gcd(long a, long b) {
        long c = 0;

        if(a<0)  a=-a;
        if(b<0)  b=-b;
        while (b>0) {
            c = a % b;
            a = b;
            b = c;
        }
        return a;
    }
}


import java.util.Scanner;
import java.io.StreamTokenizer;
import java.io.InputStreamReader;
import java.io.IOException;
import java.util.Arrays;
import java.io.PrintStream;
import java.io.BufferedReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 * @author KNIGHT0X300
 */
public class Main {
	public static void main(String[] args) {
		InputStream inputStream = System.in;
		OutputStream outputStream = System.out;
		InputStreamReader in = new InputStreamReader(inputStream);
		PrintWriter out = new PrintWriter(outputStream);
		TaskA solver = new TaskA();
		solver.solve(1, in, out);
		out.close();
	}
}

class TaskA {
    StreamTokenizer in;
    PrintWriter out;
    BufferedReader re;
    Scanner sc;
    public void solve (int testNumber, InputStreamReader in, PrintWriter out)  {

          this.in = new StreamTokenizer(new BufferedReader(in));
          this.re =  new BufferedReader(in);
          this.sc = new Scanner(in);
          this.out = out;
          try {
                      this.solve();
                  } catch (IOException e) {
                      e.printStackTrace();  //To change body of catch statement use File | Settings | File Templates.
                  }
          out.flush();

    }

         /////////////////////////////////////////////////////////////
     int nextInt() throws IOException
       {
          in.nextToken();
          return (int)in.nval;
       }

     void solve() throws IOException
       {
            int n=nextInt();
           long[] A = new  long[n];
           long[] sum = new  long[n];
           for (int i=0;i<n;i++){
               A[i]=nextInt();

           }
           Arrays.sort(A);
           for (int i=0;i<n;i++){

               if(i==0)
                   sum[i]=A[i];
               else
                   sum[i]=sum[i-1]+A[i];
           }

        long num=sum[n-1],den=n;
           for (int i=0;i<n-1;i++){
             num+=2*( (long)(i+1)*A[i+1]-sum[i]);

           }
           long gg=   gcd(num,den);
           num/=gg;den/=gg;
           out.println(num+" "+den);
         // do the sum
       }
    public static long gcd(long a, long b) {
        long c = 0;

        if(a<0)  a=-a;
        if(b<0)  b=-b;
        while (b>0) {
            c = a % b;
            a = b;
            b = c;
        }
        return a;
    }
}


import java.util.*;
import java.io.*;
import java.math.*;

public class Main {
	public static void main(String[] args) {
		InputStream inputStream = System.in;
		OutputStream outputStream = System.out;
		InputReader in = new InputReader(inputStream);
		PrintWriter out = new PrintWriter(outputStream);
		Solver solver = new Solver();
		solver.solve(in, out);
		out.close();
	}
}

class Solver {
	public void solve(InputReader in, PrintWriter out) {
		int n  = in.nextInt();
		int[] a = new int[n];
		for (int i = 0; i < n; i++) {
			a[i] = in.nextInt();
		}
		long ans = 0;
		for (int i = 0; i < n; i++) {
			ans += a[i];
		}
		for (int i = 1; i < n; i++) {
			ans += ((long)(a[i] - a[i - 1])) * 2 * (n - 1);
		}
		int gcd = Integer.parseInt(BigInteger.valueOf(ans).gcd(BigInteger.valueOf(n)).toString());
		ans /= gcd;
		n /= gcd;
		out.format("%d %d\n", ans, n);
	}
}

class InputReader {
	private BufferedReader reader;
	private StringTokenizer tokenizer;

	public InputReader(InputStream stream) {
		reader = new BufferedReader(new InputStreamReader(stream));
		tokenizer = null;
	}

	public String next() {
		while (tokenizer == null || !tokenizer.hasMoreTokens()) {
			try {
				tokenizer = new StringTokenizer(reader.readLine());
			} catch (IOException e) {
				throw new RuntimeException(e);
			}
		}
		return tokenizer.nextToken();
	}

	public long nextLong() {
		return Long.parseLong(next());
	}

	public int nextInt() {
		return Integer.parseInt(next());
	}

	public double nextDouble() {
		return Double.parseDouble(next());
	}
}


import java.util.*;
import java.io.*;
import java.math.*;

public class Main {
	public static void main(String[] args) {
		InputStream inputStream = System.in;
		OutputStream outputStream = System.out;
		InputReader in = new InputReader(inputStream);
		PrintWriter out = new PrintWriter(outputStream);
		Solver solver = new Solver();
		solver.solve(in, out);
		out.close();
	}
}

class Solver {
	long res = 0;
	boolean[] used;
	int[] a;
	/*
	void rec(int st, int n, int cur, int prev) {
		if (st == n) {
			res += cur;
			return;
		}
		for (int i = 0; i < n; i++) {
			if (!used[i]) {
				used[i] = true;
				rec(st + 1, n, cur + Math.abs(prev - a[i]), a[i]);
				used[i] = false;
			}
		}
	}
	long fact(int n) {
		if (n <= 1)
			return 1;
		return n * fact(n - 1);
	}*/
	public void solve(InputReader in, PrintWriter out) {
		int n  = in.nextInt();
		a = new int[n];
		for (int i = 0; i < n; i++) {
			a[i] = in.nextInt();
		}
		Arrays.sort(a);
		//used = new boolean[n];
		//rec(0, n, 0, 0);
		//long f = fact(n);
		//int gcd = Integer.parseInt(BigInteger.valueOf(res).gcd(BigInteger.valueOf(f)).toString());
		//f /= gcd;
		//res /= gcd;
		//out.format("%d %d\n", res, f);
		long ans = 0;
		for (int i = 0; i < n; i++) {
			ans += a[i];
		}
		long[] dp = new long[n];
		for (int i = 1; i < n; i++) {
			dp[i] = dp[i - 1] + ((long)(a[i] - a[i - 1])) * i;
			ans += dp[i] * 2;
		}
		int gcd = Integer.parseInt(BigInteger.valueOf(ans).gcd(BigInteger.valueOf(n)).toString());
		ans /= gcd;
		n /= gcd;
		out.format("%d %d\n", ans, n);
	}
}

class InputReader {
	private BufferedReader reader;
	private StringTokenizer tokenizer;

	public InputReader(InputStream stream) {
		reader = new BufferedReader(new InputStreamReader(stream));
		tokenizer = null;
	}

	public String next() {
		while (tokenizer == null || !tokenizer.hasMoreTokens()) {
			try {
				tokenizer = new StringTokenizer(reader.readLine());
			} catch (IOException e) {
				throw new RuntimeException(e);
			}
		}
		return tokenizer.nextToken();
	}

	public long nextLong() {
		return Long.parseLong(next());
	}

	public int nextInt() {
		return Integer.parseInt(next());
	}

	public double nextDouble() {
		return Double.parseDouble(next());
	}
}


import java.util.*;
import java.io.*;
import java.math.*;

public class Main {
	public static void main(String[] args) {
		InputStream inputStream = System.in;
		OutputStream outputStream = System.out;
		InputReader in = new InputReader(inputStream);
		PrintWriter out = new PrintWriter(outputStream);
		Solver solver = new Solver();
		solver.solve(in, out);
		out.close();
	}
}

class Solver {
	public void solve(InputReader in, PrintWriter out) {
		int n  = in.nextInt();
		int[] a = new int[n];
		for (int i = 0; i < n; i++) {
			a[i] = in.nextInt();
		}
		Arrays.sort(a);
		long ans = 0;
		for (int i = 0; i < n; i++) {
			ans += a[i];
		}
		for (int i = 1; i < n; i++) {
			ans += ((long)(a[i] - a[i - 1])) * 2 * (n - 1);
		}
		int gcd = Integer.parseInt(BigInteger.valueOf(ans).gcd(BigInteger.valueOf(n)).toString());
		ans /= gcd;
		n /= gcd;
		out.format("%d %d\n", ans, n);
	}
}

class InputReader {
	private BufferedReader reader;
	private StringTokenizer tokenizer;

	public InputReader(InputStream stream) {
		reader = new BufferedReader(new InputStreamReader(stream));
		tokenizer = null;
	}

	public String next() {
		while (tokenizer == null || !tokenizer.hasMoreTokens()) {
			try {
				tokenizer = new StringTokenizer(reader.readLine());
			} catch (IOException e) {
				throw new RuntimeException(e);
			}
		}
		return tokenizer.nextToken();
	}

	public long nextLong() {
		return Long.parseLong(next());
	}

	public int nextInt() {
		return Integer.parseInt(next());
	}

	public double nextDouble() {
		return Double.parseDouble(next());
	}
}


import java.io.BufferedReader;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.math.BigInteger;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Comparator;
import java.util.LinkedList;
import java.util.Locale;
import java.util.Queue;
import java.util.Scanner;
import java.util.Stack;
import java.util.StringTokenizer;
import java.util.TreeMap;
import java.util.TreeSet;

public class Solution implements Runnable {

	BufferedReader in;
	PrintWriter out;
	StringTokenizer st;

	String nextToken() throws Exception {
		if (st == null || !st.hasMoreTokens()) st = new StringTokenizer(in.readLine());
		return st.nextToken();
	}

	int nextInt() throws Exception {
		return Integer.parseInt(nextToken());
	}

	long nextLong() throws Exception {
		return Long.parseLong(nextToken());
	}

	void solve() throws Exception {
		int n = nextInt();
		Integer[] a = new Integer[n];
		for (int i = 0; i < n; i++) a[i] = nextInt();
		Arrays.sort(a);
		BigInteger ans = BigInteger.ZERO;
		for (int i = 0; i < n; i++) {
			ans = ans.add(BigInteger.valueOf(a[i]));
		}
		for (int i = 1; i < n; i++) {
			ans = ans.add(BigInteger.valueOf(2 * (a[i] - a[i - 1])).multiply(BigInteger.valueOf(i * (n - i))));
		}
		BigInteger gcd = ans.gcd(BigInteger.valueOf(n));
		out.println(ans.divide(gcd) + " " + n / gcd.longValue());
	}

	public void run() {
		try {
			in = new BufferedReader(new InputStreamReader(System.in));
			out = new PrintWriter(System.out);
//			String s = "number";
//			in = new BufferedReader(new FileReader(s + ".in"));
//			out = new PrintWriter(s + ".out");
			Locale.setDefault(Locale.US);
//			for (int tt = nextInt(); tt > 0; tt--)
				solve();
		} catch(Exception e) {
			e.printStackTrace();
			System.exit(1);
		} finally {
			out.close();
		}
	}

	public static void main(String[] args) {
		(new Thread(null, new Solution(), "1", 1 << 26)).start();
	}

}


import java.io.BufferedReader;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.math.BigInteger;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Comparator;
import java.util.LinkedList;
import java.util.Locale;
import java.util.Queue;
import java.util.Scanner;
import java.util.Stack;
import java.util.StringTokenizer;
import java.util.TreeMap;
import java.util.TreeSet;

public class Solution implements Runnable {

	BufferedReader in;
	PrintWriter out;
	StringTokenizer st;

	String nextToken() throws Exception {
		if (st == null || !st.hasMoreTokens()) st = new StringTokenizer(in.readLine());
		return st.nextToken();
	}

	int nextInt() throws Exception {
		return Integer.parseInt(nextToken());
	}

	long nextLong() throws Exception {
		return Long.parseLong(nextToken());
	}

	void solve() throws Exception {
		int n = nextInt();
		Integer[] a = new Integer[n];
		for (int i = 0; i < n; i++) a[i] = nextInt();
		Arrays.sort(a);
		BigInteger ans = BigInteger.ZERO;
		for (int i = 0; i < n; i++) {
			ans = ans.add(BigInteger.valueOf(a[i]));
		}
		for (int i = 1; i < n; i++) {
			ans = ans.add(BigInteger.valueOf(2 * (a[i] - a[i - 1])).multiply(BigInteger.valueOf((long)i * (n - i))));
		}
		BigInteger gcd = ans.gcd(BigInteger.valueOf(n));
		out.println(ans.divide(gcd) + " " + n / gcd.longValue());
	}

	public void run() {
		try {
			in = new BufferedReader(new InputStreamReader(System.in));
			out = new PrintWriter(System.out);
//			String s = "number";
//			in = new BufferedReader(new FileReader(s + ".in"));
//			out = new PrintWriter(s + ".out");
			Locale.setDefault(Locale.US);
//			for (int tt = nextInt(); tt > 0; tt--)
				solve();
		} catch(Exception e) {
			e.printStackTrace();
			System.exit(1);
		} finally {
			out.close();
		}
	}

	public static void main(String[] args) {
		(new Thread(null, new Solution(), "1", 1 << 26)).start();
	}

}


import java.util.Scanner;
import java.io.OutputStream;
import java.io.IOException;
import java.util.Arrays;
import java.io.PrintWriter;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 * @author Zyflair Griffane
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskC solver = new TaskC();
        solver.solve(1, in, out);
        out.close();
    }
}

class TaskC {
    public void solve(int testNumber, Scanner in, PrintWriter out) {
        int n = Integer.parseInt(in.nextLine());
        String[] nums = in.nextLine().trim().split(" ");
        long sum = 0;
        long diff = 0;
        long[] arr = new long[n];
        for (int i = 0; i < n; i++) {
            arr[i] = Integer.parseInt(nums[i]);
        }
        Arrays.sort(arr);
        for (int i = 0; i < n; i++) {
            diff += arr[i] * i - sum;
            sum += arr[i];
        }
        long num = diff << 1;
        num += sum;
        long g = gcd(num, n);
        out.println(num / g + " " + n / g);
    }
    public long gcd(long a, long b) {
        return b == 0 ? a : gcd(b, a % b);
    }
}


import java.util.*;
import java.io.*;
import java.math.BigInteger;
public class Main {

    public static long gcd(long i, long j) {
        if (i<0||j<0) return 1;
        if (i < j)
            return gcd(j, i);
        if (j == 0)
            return i;
        else
            return gcd(j, i % j);
    }

    public static BigInteger gcd2(BigInteger i, BigInteger j) {
        //if (<0||j<0) return 1;
        if (i.compareTo(j)<0)
            return gcd2(j, i);
        if (j.equals(new BigInteger("0")))
            return i;
        else{
            BigInteger x = i.mod(j);
            return gcd2(j, x);
        }
    }

    public static void main(String[] args) throws NumberFormatException, IOException {
        BufferedReader c = new BufferedReader(new InputStreamReader(System.in));
        int n = Integer.parseInt(c.readLine());

        String s[] = c.readLine().split(" ");
        int[] a = new int[n];
        for (int i=0; i<n; i++){
            a[i] = Integer.parseInt(s[i]);
        }
        Arrays.sort(a);

        long ans = 0;
        BigInteger b = new BigInteger("0");
        for (int i =0 ;i<n; i++){
            int k = i+1;
            long x = 2*(((k-1)*(k-2)) - (n-k)*(n-k-1) + (k-1)) + (2*k-n-1);
            //x= x*a[i];
            //ans+=x;
            BigInteger temp = (new BigInteger(Long.toString(x)));
            temp = temp.multiply(new BigInteger(Integer.toString(a[i])));
            b = b.add(temp);
        }

        BigInteger demon = new BigInteger(Integer.toString(n*(n-1)));

        BigInteger x = gcd2 (b, demon);
        b = b.divide(x);
        demon = demon.divide(x);
        System.out.println(b.toString() + " " + demon.toString());

    }

}


import java.util.*;
import java.io.*;
public class Main {

    public static long gcd(long i, long j) {
        if (i < j)
            return gcd(j, i);
        if (j == 0)
            return i;
        else
            return gcd(j, i % j);
    }

    public static void main(String[] args) throws NumberFormatException, IOException {
        BufferedReader c = new BufferedReader(new InputStreamReader(System.in));
        int n = Integer.parseInt(c.readLine());

        String s[] = c.readLine().split(" ");
        int[] a = new int[n];
        for (int i=0; i<n; i++){
            a[i] = Integer.parseInt(s[i]);
        }
        Arrays.sort(a);

        long ans = 0;
        for (int i =0 ;i<n; i++){
            int k = i+1;
            long x = 2*(((k-1)*(k-2)) - (n-k)*(n-k-1) + (k-1)) + (2*k-n-1);
            x= x*a[i];
            ans+=x;
        }

        long x = gcd (ans, n*(n-1));
        System.out.println((ans/x) + " " + ((n*(n-1))/x));

    }

}


import java.util.*;
import java.io.*;
public class Main {

    public static long gcd(long i, long j) {
        if (i<0||j<0) return 1;
        if (i < j)
            return gcd(j, i);
        if (j == 0)
            return i;
        else
            return gcd(j, i % j);
    }

    public static void main(String[] args) throws NumberFormatException, IOException {
        BufferedReader c = new BufferedReader(new InputStreamReader(System.in));
        int n = Integer.parseInt(c.readLine());

        String s[] = c.readLine().split(" ");
        int[] a = new int[n];
        for (int i=0; i<n; i++){
            a[i] = Integer.parseInt(s[i]);
        }
        Arrays.sort(a);

        long ans = 0;
        for (int i =0 ;i<n; i++){
            int k = i+1;
            long x = 2*(((k-1)*(k-2)) - (n-k)*(n-k-1) + (k-1)) + (2*k-n-1);
            x= x*a[i];
            ans+=x;
        }

        long x = gcd (ans, n*(n-1));
        System.out.println((ans/x) + " " + ((n*(n-1))/x));

    }

}


import java.util.*;
import java.io.*;
import java.math.BigInteger;
public class Main {

    public static long gcd(long i, long j) {
        if (i<0||j<0) return 1;
        if (i < j)
            return gcd(j, i);
        if (j == 0)
            return i;
        else
            return gcd(j, i % j);
    }

    public static BigInteger gcd2(BigInteger i, BigInteger j) {
        //if (<0||j<0) return 1;
        if (i.compareTo(j)<0)
            return gcd2(j, i);
        if (j.equals(new BigInteger("0")))
            return i;
        else{
            BigInteger x = i.mod(j);
            return gcd2(j, x);
        }
    }

    public static void main(String[] args) throws NumberFormatException, IOException {
        BufferedReader c = new BufferedReader(new InputStreamReader(System.in));
        int n = Integer.parseInt(c.readLine());

        String s[] = c.readLine().split(" ");
        int[] a = new int[n];
        for (int i=0; i<n; i++){
            a[i] = Integer.parseInt(s[i]);
        }
        Arrays.sort(a);

        long ans = 0;
        BigInteger b = new BigInteger("0");
        for (int i =0 ;i<n; i++){
            long k = i+1;
            long n_d = n;
            long x = 2*(((k-1)*(k-2)) - (n_d-k)*(n_d-k-1) + (k-1)) + (2*k-n_d-1);
            //x= x*a[i];
            //ans+=x;
            BigInteger temp = (new BigInteger(Long.toString(x)));
            temp = temp.multiply(new BigInteger(Integer.toString(a[i])));
            b = b.add(temp);
        }

        long n_dash = n;
        BigInteger demon = new BigInteger(Long.toString(n_dash*(n_dash-1)));
        BigInteger x = gcd2 (b, demon);

        b = b.divide(x);
        demon = demon.divide(x);
        System.out.println(b.toString() + " " + demon.toString());

    }

}


import java.util.*;
import java.io.*;
import java.math.BigInteger;
public class Main {

    public static long gcd(long i, long j) {
        if (i<0||j<0) return 1;
        if (i < j)
            return gcd(j, i);
        if (j == 0)
            return i;
        else
            return gcd(j, i % j);
    }

    public static BigInteger gcd2(BigInteger i, BigInteger j) {
        //if (i<0||j<0) return 1;
        if (i.compareTo(j)<0)
            return gcd2(j, i);
        if (j.equals(new BigInteger("0")))
            return i;
        else{
            BigInteger x = i.mod(j);
            return gcd2(j, x);
        }
    }

    public static void main(String[] args) throws NumberFormatException, IOException {
        BufferedReader c = new BufferedReader(new InputStreamReader(System.in));
        int n = Integer.parseInt(c.readLine());

        String s[] = c.readLine().split(" ");
        int[] a = new int[n];
        for (int i=0; i<n; i++){
            a[i] = Integer.parseInt(s[i]);
        }
        Arrays.sort(a);

        long ans = 0;
        BigInteger b = new BigInteger("0");
        for (int i =0 ;i<n; i++){
            int k = i+1;
            long x = 2*(((k-1)*(k-2)) - (n-k)*(n-k-1) + (k-1)) + (2*k-n-1);
            x= x*a[i];
            ans+=x;
            b = b.add(new BigInteger(Long.toString(x)));
        }
        BigInteger demon = new BigInteger(Integer.toString(n*(n-1)));

        BigInteger x = gcd2 (b, demon);
        b = b.divide(x);
        demon = demon.divide(x);
        System.out.println(b.toString() + " " + demon.toString());

    }

}


import java.util.*;
import java.io.*;
import java.math.BigInteger;
public class Main {

    public static long gcd(long i, long j) {
        if (i<0||j<0) return 1;
        if (i < j)
            return gcd(j, i);
        if (j == 0)
            return i;
        else
            return gcd(j, i % j);
    }

    public static BigInteger gcd2(BigInteger i, BigInteger j) {
        //if (<0||j<0) return 1;
        if (i.compareTo(j)<0)
            return gcd2(j, i);
        if (j.equals(new BigInteger("0")))
            return i;
        else{
            BigInteger x = i.mod(j);
            return gcd2(j, x);
        }
    }

    public static void main(String[] args) throws NumberFormatException, IOException {
        BufferedReader c = new BufferedReader(new InputStreamReader(System.in));
        int n = Integer.parseInt(c.readLine());

        String s[] = c.readLine().split(" ");
        int[] a = new int[n];
        for (int i=0; i<n; i++){
            a[i] = Integer.parseInt(s[i]);
        }
        Arrays.sort(a);

        long ans = 0;
        BigInteger b = new BigInteger("0");
        for (int i =0 ;i<n; i++){
            int k = i+1;
            long x = 2*(((k-1)*(k-2)) - (n-k)*(n-k-1) + (k-1)) + (2*k-n-1);
            //x= x*a[i];
            //ans+=x;
            BigInteger temp = (new BigInteger(Long.toString(x)));
            temp = temp.multiply(new BigInteger(Integer.toString(a[i])));
            b = b.add(temp);
        }

        long n_dash = n;
        BigInteger demon = new BigInteger(Long.toString(n_dash*(n_dash-1)));

        BigInteger x = gcd2 (b, demon);
        b = b.divide(x);
        demon = demon.divide(x);
        System.out.println(b.toString() + " " + demon.toString());

    }

}


import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.math.BigInteger;
import java.util.Arrays;
import java.util.InputMismatchException;

public class A {
	public static void main(String[] args) throws Exception {
		InputReader in = new InputReader(System.in);
		PrintWriter out = new PrintWriter(System.out);

		long n = in.nextLong();
		long[] arr = new long[(int)n];
		for(int i = 0 ; i < arr.length; i++){
			arr[i] = in.nextLong();
		}

		Arrays.sort(arr);

		//sum from end to i
		long[] sum = new long[(int)n];

		sum[(int)(n-1)] = arr[(int)n-1];
		for(int i = (int)(n-2); i >= 0; i--){
			sum[i] = sum[i+1] + arr[i];
		}

		long num = 0;
		for(int start = 0; start < n-1; start++){
			long curPairDiff = sum[start+1] - (long)(n-start-1) * arr[start];
			num += curPairDiff;
		}

		num = num * 2 * (n-1);
		BigInteger[] facs = fac(n);
		BigInteger den = facs[(int)n];
		BigInteger numB = BigInteger.valueOf(num).add(BigInteger.valueOf(sum[0]).multiply(facs[(int)(n-1)]));

		BigInteger gcd = numB.gcd(den);

		out.println(numB.divide(gcd) + " " + den.divide(gcd));
		out.close();
	}

	static BigInteger[] fac(long n){
		BigInteger[] arr = new BigInteger[(int)n+1];
		BigInteger cur = BigInteger.ONE;
		arr[1] = cur;
		for(int i = 2; i<=n;i++){
			cur = cur.multiply(BigInteger.valueOf(i));
			arr[i] = cur;
		}
		return arr;
	}

	static class InputReader {
		private InputStream stream;
		private byte[] buf = new byte[1024];
		private int curChar;
		private int numChars;
		private SpaceCharFilter filter;

		public InputReader(InputStream stream) {
			this.stream = stream;
		}

		public int read() {
			if (numChars == -1)
				throw new InputMismatchException();
			if (curChar >= numChars) {
				curChar = 0;
				try {
					numChars = stream.read(buf);
				} catch (IOException e) {
					throw new InputMismatchException();
				}
				if (numChars <= 0)
					return -1;
			}
			return buf[curChar++];
		}

		public int nextInt() {
			int c = read();
			while (isSpaceChar(c))
				c = read();
			int sgn = 1;
			if (c == '-') {
				sgn = -1;
				c = read();
			}
			int res = 0;
			do {
				if (c < '0' || c > '9')
					throw new InputMismatchException();
				res *= 10;
				res += c - '0';
				c = read();
			} while (!isSpaceChar(c));
			return res * sgn;
		}

		public long nextLong() {
			int c = read();
			while (isSpaceChar(c))
				c = read();
			int sgn = 1;
			if (c == '-') {
				sgn = -1;
				c = read();
			}
			long res = 0;
			do {
				if (c < '0' || c > '9')
					throw new InputMismatchException();
				res *= 10;
				res += c - '0';
				c = read();
			} while (!isSpaceChar(c));
			return res * sgn;
		}

		public String nextToken() {
			int c = read();
			while (isSpaceChar(c))
				c = read();
			StringBuilder res = new StringBuilder();
			do {
				res.appendCodePoint(c);
				c = read();
			} while (!isSpaceChar(c));
			return res.toString();
		}

		public boolean isSpaceChar(int c) {
			if (filter != null)
				return filter.isSpaceChar(c);
			return isWhitespace(c);
		}

		public static boolean isWhitespace(int c) {
			return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
		}

		public interface SpaceCharFilter {
			public boolean isSpaceChar(int ch);
		}
	}
}


import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.math.BigInteger;
import java.util.Arrays;
import java.util.InputMismatchException;

public class A {
	public static void main(String[] args) throws Exception {
		InputReader in = new InputReader(System.in);
		PrintWriter out = new PrintWriter(System.out);

		long n = in.nextLong();
		long[] arr = new long[(int)n];
		for(int i = 0 ; i < arr.length; i++){
			arr[i] = in.nextLong();
		}

		Arrays.sort(arr);

		//sum from end to i
		long[] sum = new long[(int)n];

		sum[(int)(n-1)] = arr[(int)n-1];
		for(int i = (int)(n-2); i >= 0; i--){
			sum[i] = sum[i+1] + arr[i];
		}

		long num = 0;
		for(int start = 0; start < n-1; start++){
			long curPairDiff = sum[start+1] - (long)(n-start-1) * arr[start];
			num += curPairDiff;
		}

		num = num * 2 + sum[0];
		BigInteger nn = BigInteger.valueOf(num);
		BigInteger d =  BigInteger.valueOf(n);
		BigInteger gcd = nn.gcd(d);

		out.println(nn.divide(gcd) + " " + d.divide(gcd));
		out.close();
	}

	static class InputReader {
		private InputStream stream;
		private byte[] buf = new byte[1024];
		private int curChar;
		private int numChars;
		private SpaceCharFilter filter;

		public InputReader(InputStream stream) {
			this.stream = stream;
		}

		public int read() {
			if (numChars == -1)
				throw new InputMismatchException();
			if (curChar >= numChars) {
				curChar = 0;
				try {
					numChars = stream.read(buf);
				} catch (IOException e) {
					throw new InputMismatchException();
				}
				if (numChars <= 0)
					return -1;
			}
			return buf[curChar++];
		}

		public int nextInt() {
			int c = read();
			while (isSpaceChar(c))
				c = read();
			int sgn = 1;
			if (c == '-') {
				sgn = -1;
				c = read();
			}
			int res = 0;
			do {
				if (c < '0' || c > '9')
					throw new InputMismatchException();
				res *= 10;
				res += c - '0';
				c = read();
			} while (!isSpaceChar(c));
			return res * sgn;
		}

		public long nextLong() {
			int c = read();
			while (isSpaceChar(c))
				c = read();
			int sgn = 1;
			if (c == '-') {
				sgn = -1;
				c = read();
			}
			long res = 0;
			do {
				if (c < '0' || c > '9')
					throw new InputMismatchException();
				res *= 10;
				res += c - '0';
				c = read();
			} while (!isSpaceChar(c));
			return res * sgn;
		}

		public String nextToken() {
			int c = read();
			while (isSpaceChar(c))
				c = read();
			StringBuilder res = new StringBuilder();
			do {
				res.appendCodePoint(c);
				c = read();
			} while (!isSpaceChar(c));
			return res.toString();
		}

		public boolean isSpaceChar(int c) {
			if (filter != null)
				return filter.isSpaceChar(c);
			return isWhitespace(c);
		}

		public static boolean isWhitespace(int c) {
			return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
		}

		public interface SpaceCharFilter {
			public boolean isSpaceChar(int ch);
		}
	}
}


#include<iostream>
#include <algorithm>
using namespace std;
int main()
{

	int n,out,max;
	int boy[360];
	int girl[360];
	char g[5000];int f[5000]; int e[5000];
	while(cin>>n)
	{
		boy[360]=0;
		girl[360]=0;
		out=0;
		max=0;
		for(int i=0;i<n;i++)
		{
			cin>>g[i]>>f[i]>>e[i];
			for(int d=f[i];d<=e[i];d++)
			{
				if(g[i]=='M')boy[d]++;
				else girl[d]++;
			}
		}
		for(int i=0;i<=366;i++)
			{
				out=min(girl[i],boy[i]);
				if(out>max)max=out;
			}
	cout<<max*2<<endl;

	}

return 0;
}


#include<iostream>
#include <algorithm>
using namespace std;
int main()
{
	int n,f,e,n1,cm,cf,ansm,ansf,maxm,maxf;
	char g;
	pair<int ,int >m[5000];
	pair<int ,int >fe[5000];
	while(cin>>n)
	{
		n1=n;
		cf=cm=maxm=maxf=0;

		while(n--)
		{
			cin>>g>>f>>e;
			if(g=='M') {m[n1-n]=make_pair(f,e);cm++;}
			else {fe[n1-n]=make_pair(f,e);cf++;}
		}
		maxm=maxf=0;
	for(int i=0;i<=cm;i++)
	{
		ansm=ansf=0;
		for(int j=0;j<=cm;j++)
		{
			if(m[j].first>=m[i].first&&m[j].first<=m[i].second)ansm++;
		}
		for(int j=0;j<=cf;j++)
		{
			if(fe[j].first>=m[i].first&&fe[j].first<=m[i].second)ansf++;
		}
		if(ansm>maxm)maxm=ansm;
		if(ansf>maxf)maxf=ansf;

	}

	cout<<min(maxf,maxm)*2<<endl;

	}
return 0;
}


#include<iostream>
#include <algorithm>
using namespace std;
int main()
{
	int n,f,e,n1,cm,cf,ansm,ansf,maxm,maxf;
	char g;
	pair<int ,int >m[5000];
	pair<int ,int >fe[5000];
	while(cin>>n)
	{
		n1=n;
		cf=cm=maxm=maxf=0;

		while(n--)
		{
			cin>>g>>f>>e;
			if(g=='M') {m[n1-n]=make_pair(f,e);cm++;}
			else {fe[n1-n]=make_pair(f,e);cf++;}
		}
		maxm=maxf=0;
	for(int i=0;i<=cm;i++)
	{
		ansm=ansf=0;
		for(int j=1;j<=cm;j++)
		{
			if(m[j].first>=m[i].first&&m[j].first<=m[i].second)ansm++;
		}
		for(int j=1;j<=cf;j++)
		{
			if(fe[j].first>=m[i].first&&fe[j].first<=m[i].second)ansf++;
		}
		if(ansm>maxm)maxm=ansm;
		if(ansf>maxf)maxf=ansf;

	}

	cout<<min(maxf,maxm)*2<<endl;

	}
return 0;
}


#include<iostream>
#include <algorithm>
using namespace std;
int main()
{
	int n,f,e,n1,cm,cf,ansm,ansf,maxm,maxf;
	char g;
	pair<int ,int >m[5000];
	pair<int ,int >fe[5000];
	while(cin>>n)
	{
		n1=n;
		cf=cm=maxm=maxf=0;

		while(n--)
		{
			cin>>g>>f>>e;
			if(g=='M') {m[n1-n]=make_pair(f,e);cm++;}
			else {fe[n1-n]=make_pair(f,e);cf++;}
		}
		maxm=maxf=0;
	for(int i=1;i<=cm;i++)
	{
		ansm=ansf=0;
		for(int j=1;j<=cm;j++)
		{
			if(m[j].first>=m[i].first&&m[j].first<=m[i].second)ansm++;
		}
		for(int j=1;j<=cf;j++)
		{
			if(m[j].first>=fe[i].first&&fe[j].first<=m[i].second)ansf++;
		}
		if(ansm>maxm)maxm=ansm;
		if(ansf>maxf)maxf=ansf;

	}
	cout<<min(maxf,maxm)*2<<endl;

	}
return 0;
}


#include<iostream>
#include <algorithm>
using namespace std;
int main()
{

	int n,out,max;
	int boy[360];
	int girl[360];
	char g[5000];int f[5000]; int e[5000];
	while(cin>>n)
	{
		boy[360]=0;
		girl[360]=0;
		out=0;
		max=0;
		for(int i=0;i<n;i++)
		{
			cin>>g[i]>>f[i]>>e[i];
			for(int d=f[i];d<=e[i];d++)
			{
				if(g[i]=='M')boy[d]++;
				else girl[d]++;
			}
		}
		for(int i=0;i<360;i++)
			{
				out=min(girl[i],boy[i]);
				if(out>max)max=out;
			}
	cout<<max*2<<endl;

	}

return 0;
}


#include <iostream>
#include <cstdio>
#include <algorithm>
using namespace std;
int start[5500], endd[5500];
int sex[5500];
char s[5];
int main()
{
	int n; cin >> n;
	for (int i = 0; i < n; i++)
	{
		scanf("%s", s);
		if (s[0] == 'M')sex[i] = 1;
		else sex[i] = 0;
		scanf("%d%d", &start[i], &endd[i]);
	}
	int c0, c1, ans = 0;
	for (int i = 117; i <= 366; i++)
	{
		c0 = 0; c1 = 0;
		for (int j = 0; j < n;j++)
			if (start[j] <= i && endd[j] >= i)
			{
				if (sex[j] == 0)c0++;
				else c1++;
			}
		ans = max(ans, 2 * min(c0, c1));
	}
	cout << ans << endl;
	return 0;
}


#include <iostream>
#include <cstdio>
#include <algorithm>
using namespace std;
int start[5500], endd[5500];
int sex[5500];
char s[5];
int main()
{
	int n; cin >> n;
	for (int i = 0; i < n; i++)
	{
		scanf("%s", s);
		if (s[0] == 'M')sex[i] = 1;
		else sex[i] = 0;
		scanf("%d%d", &start[i], &endd[i]);
	}
	int c0, c1, ans = 0;
	for (int i = 1; i <= 366; i++)
	{
		c0 = 0; c1 = 0;
		for (int j = 0; j < n;j++)
			if (start[j] <= i && endd[j] >= i)
			{
				if (sex[j] == 0)c0++;
				else c1++;
			}
		ans = max(ans, 2 * min(c0, c1));
	}
	cout << ans << endl;
	return 0;
}


#include <iostream>
#include <set>
#include <vector>
#include <algorithm>
#include <string>
#include <unordered_map>
#include <unordered_set>
typedef long long ll;
void main()
{
	std::ios::sync_with_stdio(false);
	std::unordered_map<std::string, std::string> dict;
	int n(0);std::cin>>n;
	std::pair<int,int> input[367];
	int output(0);
	bool flag = true;
	for (int i = 1; i < 367; i++)
		input[i] = std::make_pair(0, 0);
	for (int i = 0; i < n; i++)
	{
		std::string g; int a, b;
		std::cin >> g>>a>>b;
		if (g == "M")
		{
			for (int i = a; i <= b; i++)
			{
				input[i].first+= 1;
				input[i].second+=1;
			}
		}
		else
		{
			for (int i = a; i <= b; i++)
			{
				input[i].second+=1;
			}
		}
	}
	for (int i = 1; i <=366; i++)
	{
		int t = std::min(input[i].first, input[i].second - input[i].first)*2;
		output = std::max(t, output);
	}
	std::cout << output;
}


#include<iostream>
#include<algorithm>
using namespace std;
const int n_ = 1e5 + 1000, days = 366;
int n, st[n_], e[n_], females[days], males[days], ans = 0, day = 1;
char s[n_];
void main()
{
	cin>>n;
	for(int i=0;i<n;i++){
		cin>>s[i]>>st[i]>>e[i];
		for(int d=st[i];d<=e[i];d++){
			if(s[i]=='M') males[d]++;
			else females[d]++;
		}
	}
	for(int i=1;i<366;i++){
		if(ans<2*min(males[i],females[i]))
			ans=2*min(males[i],females[i]);
	}
	//for(int i=1;i<366;i++){
	//	cout<<males[i]<<" ";}
	cout<<ans<<endl;
}


#include<iostream>
#include<algorithm>
using namespace std;
const int n_ = 1e5 + 1000, days = 366;
int n, st[n_], e[n_], females[days], males[days], ans = 0, day = 1;
char s[n_];
void main()
{
	cin>>n;
	for(int i=0;i<n;i++){
		cin>>s[i]>>st[i]>>e[i];
		for(int d=st[i];d<=e[i];d++){
			if(s[i]=='M') males[d]++;
			else females[d]++;
		}
	}
	for(int i=1;i<=366;i++){
		if(ans<2*min(males[i],females[i]))
			ans=2*min(males[i],females[i]);
	}
	//for(int i=1;i<366;i++){
	//	cout<<males[i]<<" ";}
	cout<<ans<<endl;
}


#include <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <string>
#include <stdio.h>
#include <algorithm>
#include <fstream>
#include <iomanip>
#include <queue>
#include <stack>
#include <set>
#include<regex>
#include <stdio.h>
using namespace std;
struct guest
{
	int t;
	int g;
	int gender;
	guest(int a, int g0,int gen)
	{
		t = a;
		g = g0;
		gender = gen;
	}
	int act() const { return t; }
	int go() const { return g; }
	guest() {};
};
bool operator<(guest const & L, guest const & R) { // The operator takes const references - it can compare const objects
	return (L.act() < R.act()||(L.act()==R.act()&&L.go()<R.go()));
}
int main() {
	//ifstream in("input.txt");
	//ofstream out("output.txt");
	int n;
	char gender;
	int come, go;
	vector<guest > events;
	cin >> n;
	cin >> ws;
	events.resize(2 * n);
	for (int i = 0; i < 2*n; i+=2)
	{
		cin >> gender >> come >> go;
		cin >> ws;
		//scanf("%c%d%d", &gender, &come, &go);
		if (gender == 'M')
		{
			events[i] = guest(come, 0, 1);
			events[i + 1] = guest(go, 1, 1);
		}
		else
		{
			events[i] = guest(come, 0, 2);
			events[i + 1] = guest(go, 1, 2);
		}
	}
	sort(events.begin(), events.end());
	int ans = 0;
	int m, f;
	m = 0;
	f = 0;
	for (int i = 0; i < 2 * n; ++i)
	{
		if (events[i].g == 0)
		{
			if (events[i].gender == 1)
				m++;
			else
				f++;
		}
		else
		{
			if (events[i].gender == 1)
				m--;
			else
				f--;
		}
		ans = max(ans, 2 * min(m, f));
	}
	cout << ans << endl;
	system("pause");
	//in.close();
	//out.close();
	return 0;
}