n = int(input()) x = list(map(int,input().split())) s = sum(x); mod = 10**9+7; a = 0 for v in x: a += v*(v-1)//2 print((s-a*2*pow(s,mod-2,mod))%mod)