func_code_string: #include <bits/stdc++.h>   using namespace std;   const int N = 1e5 + 10;   const int MOD = 1e9 + 7;   template <typename Tp>   void read(Tp &x) {     x = 0;     int op = 1;     char ch = getchar();     while (!isdigit(ch)) {       if (ch ==  - ) op = -1;       ch = getchar();     }     while (isdigit(ch)) {       x = x * 10 + ch -  0 ;       ch = getchar();     }     x *= op;   }   template <typename Tp>   void CMax(Tp &x, Tp y) {     if (y > x) x = y;   }   template <typename Tp>   void CMin(Tp &x, Tp y) {     if (y < x) x = y;   }   int n, m, a[N], mx;   int f[N], res1, res2, ans;   void norm(int &x) {     while (x >= MOD) x -= MOD;     while (x < 0) x += MOD;   }   int Inv(int x, int p = MOD - 2) {     int ret = 1;     while (p) {       if (p & 1) ret = 1ll * ret * x % MOD;       x = 1ll * x * x % MOD;       p >>= 1;     }     return ret;   }   int main() {     read(n);     for (int i = (1); i <= (n); ++i) read(a[i]), m += a[i], CMax(mx, a[i]);     ans = 1ll * m * (m - 1) % MOD;     for (int i = (1); i <= (mx); ++i) {       res1 += res2;       norm(res1);       int v = Inv(i - 1 - m + MOD);       res2 += v;       norm(res2);       res1 += v;       norm(res1);       f[i] = 1ll * res1 * (m - 1) % MOD;       norm(f[i]);     }     for (int i = (1); i <= (n); ++i) ans += f[a[i]], norm(ans);     printf( %d , ans);     return 0;   }   