#include long long power_mod (long long a, long long b, long long mod_num) { long long ans = 1LL; if (b > 0LL) { ans = power_mod(a, b/2LL, mod_num); ans = (ans * ans) % mod_num; if (b%2LL == 1LL) { ans = (ans * (a % mod_num)) % mod_num; } } return ans; } int main () { int n = 0; long long x = 0LL; int res = 0; long long ans = 0LL; long long mod_num = 1000000007LL; long long sum_sq = 0LL; res = scanf("%d", &n); for (int i = 0; i < n; i++) { res = scanf("%lld", &x); ans += x; sum_sq += x*x; } ans = ((ans*ans-sum_sq)%mod_num)*power_mod(ans, mod_num-2LL, mod_num)+1LL; printf("%lld\n", ans%mod_num); return 0; }