import sys input = lambda :sys.stdin.readline()[:-1] ni = lambda :int(input()) na = lambda :list(map(int,input().split())) sys.setrecursionlimit(2*10**5) yes = lambda :print("yes");Yes = lambda :print("Yes") no = lambda :print("no");No = lambda :print("No") ######################################################################### mod = 10**9+7 n = ni() x = na() ans = sum(x) * sum(x) for i in range(n): ans -= x[i] ** 2 print((ans * pow(sum(x), mod-2, mod)+1)%mod)