#include using namespace std; const long long MOD = 1000000007; long long modpow(long long a, long long b){ long long ans = 1; while (b > 0){ if (b % 2 == 1){ ans *= a; ans %= MOD; } a *= a; a %= MOD; b /= 2; } return ans; } long long modinv(long long a){ return modpow(a, MOD - 2); } int main(){ int N; cin >> N; vector x(N); for (int i = 0; i < N; i++){ cin >> x[i]; } int S = 0; for (int i = 0; i < N; i++){ S += x[i]; } long long all = (long long) S * (S - 1) / 2; long long same = 0; for (int i = 0; i < N; i++){ same += (long long) x[i] * (x[i] - 1) / 2; } long long p = (same % MOD) * modinv(all % MOD) % MOD; long long q = MOD + 1 - p; cout << ((S - 1) * q + 1) % MOD << endl; }