// #pragma GCC optimize("Ofast,unroll-loops")
// #pragma GCC optimize("O3")
// #pragma GCC target("avx2,bmi,bmi2,lzcnt,popcnt")
#include <bits/stdc++.h>
using namespace std;
#ifdef LOCAL
#include "algo/debug.h"
#else
#define debug(...) 42
#endif
#define int long long
#define fi first
#define se second
#define pb emplace_back
#define pf emplace_front
#define SZ(x) ((int)(x).size())
#define ALL(x) (x).begin(),(x).end()
#define RALL(x) (x).rbegin(),(x).rend()
#define F_OR(i, a, b, s) for (int i = (a); (s) > 0 ? i <= (b) : i >= (b); i += (s))
#define F_OR1(e) F_OR(i, 0, (e), 1)
#define F_OR2(i, e) F_OR(i, 0, (e) - 1, 1)
#define F_OR3(i, b, e) F_OR(i, b, (e), 1)
#define F_OR4(i, b, e, s) F_OR(i, b, (e), s)
#define GET5(a, b, c, d, e, ...) e
#define F_ORC(...) GET5(__VA_ARGS__, F_OR4, F_OR3, F_OR2, F_OR1)
#define FOR(...) F_ORC(__VA_ARGS__)(__VA_ARGS__)
#define file(task) if(fopen(task".INP", "r")){freopen(task".INP", "r", stdin); freopen(task".OUT", "w", stdout);}
/****************[BIT]****************/
#define getbit(x, i) ((x >> (i)) & 1)
#define lowbit(x) __builtin_ctzll(x)
#define topbit(x) 63 - __builtin_clzll(x)
#define cntbit(x) __builtin_popcountll(x)
/****************[END]****************/
using ll = long long;
using ld = double;
using ii = pair <int, int>;
using _i3 = pair <ii, int>;
using _i4 = pair <ii, ii>;
using vi2 = vector <ii>;
template<class A, class B> bool maxi(A& a, const B& b) { return (a < b ? a = b, 1 : 0); }
template<class A, class B> bool mini(A& a, const B& b) { return (a > b ? a = b, 1 : 0); }
template<class T> using MaxHeap = priority_queue< T, vector<T>, less<T> >;
template<class T> using MinHeap = priority_queue< T, vector<T>, greater<T> >;
const int INF = (int)1e9 + 5062007;
const ll LINF = (ll)8e18 + 5062007;
const long double EPS = (double)1e-14;
const long double PI = acos(-1.0);
//const int MOD = 998244353;
//const int MOD = (int)1e9 + 7;
const int MOD = 123456789;
void solve(int test_case);
signed main() {
cin.tie(nullptr), cout.tie(nullptr)->sync_with_stdio(0);
file("phuc");
cout.precision(15);
cout << fixed;
int _ = 1;
//cin >> _;
FOR(__, 1, _) solve(__);
cerr << "Time elapsed: " << 1.0 * clock() / (double)CLOCKS_PER_SEC << " s.\n";
return 0;
}
/*
*/
/*
SOLUTION ========================/
--------------------------------+/
--------------------------------+/
=================================/
*/
const int MAX = 1e5 + 5;
const int LOG = 18;
int inv[MAX], ifact[MAX], fact[MAX];
struct combine {
combine() {
inv[1] = 1;
FOR(i, 2, MAX - 5) {
inv[i] = (MOD - MOD / i) * inv[MOD % i] % MOD;
}
fact[0] = ifact[0] = 1;
FOR(i, 1, MAX - 5) {
fact[i] = fact[i - 1] * i % MOD;
ifact[i] = ifact[i - 1] * inv[i] % MOD;
}
}
} combine_;
int comb(int n, int m) {
if(n < m || m < 0) return 0;
return fact[n] * ifact[m] % MOD * ifact[n - m] % MOD;
}
int n;
int a[MAX];
void solve(int test_case) {
// cout << "Case #" << test_case << ": ";
cin >> n;
int sum = 0;
FOR(i, 1, n) cin >> a[i], sum += a[i];
int sum_prev = 0, now = 0;
sort(a + 1, a + 1 + n);
FOR(i, 1, n) {
now += a[i] * (i - 1) - sum_prev;
sum_prev += a[i];
}
sum = now * 2 + sum;
int d = gcd(sum, n);
cout << sum / d << ' ' << n / d;
}
268C - Beautiful Sets of Points | 1391C - Cyclic Permutations |
11A - Increasing Sequence | 1406A - Subset Mex |
1365F - Swaps Again | 50B - Choosing Symbol Pairs |
1719A - Chip Game | 454B - Little Pony and Sort by Shift |
1152A - Neko Finds Grapes | 1719B - Mathematical Circus |
1719C - Fighting Tournament | 1642A - Hard Way |
285C - Building Permutation | 1719E - Fibonacci Strings |
1696C - Fishingprince Plays With Array | 1085A - Right-Left Cipher |
1508B - Almost Sorted | 1690C - Restoring the Duration of Tasks |
1055A - Metro | 1036D - Vasya and Arrays |
1139C - Edgy Trees | 37A - Towers |
353A - Domino | 409H - A + B Strikes Back |
1262A - Math Problem | 158C - Cd and pwd commands |
194A - Exams | 1673B - A Perfectly Balanced String |
1104B - Game with string | 1169B - Pairs |