#include #include #include #include #include #include #include #include #include #include #include #include using namespace std; long long modc = 1e9+7; long long mod_exp(long long b, long long e){ if (e > 0 && b == 0) return 0; long long ans = 1; b %= modc; while (e > 0){ if ((e & 1LL)) ans = (ans * b) % modc; e = e >> 1LL; b = (b*b) % modc; } return ans; } int main(){ int N; long long S=0, S2=0, ans=0; cin >> N; assert(N <= 100000); vector A(N); for (int i=0; i> A[i]; S += A[i]; S2 += (A[i]*A[i]) % modc; S2 %= modc; assert(1 <= A[i]); } assert(S <= 1e9); ans = ((S*S) % modc + modc - S2) % modc; ans = (ans * mod_exp(S, modc-2)) % modc; ans = (ans + 1) % modc; cout << ans << endl; return 0; }