Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = list(map(int, input().split()))

mod = 10 ** 9 + 7

total = 0
for i in range(N - 1):
    for j in range(i + 1, N):
        total += (A[i]%mod) * (A[j]% mod) % mod
        total %= mod
print(total)


Fixed submission:
N = int(input())
A = list(map(int, input().split()))

mod = 10 ** 9 + 7

sum_a=0
for i in A:
    sum_a+=i
    sum_a%=mod

total=0
for i in range(N - 1):
    sum_a -= A[i]
    total+=A[i]*(sum_a)
    total%=mod
print(total)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = list(map(int, input().split()))

mod = 10 ** 9 + 7

total = 0
for i in range(N - 1):
    for j in range(i + 1, N):
        total += A[i] * A[j] % mod
        total %= mod
print(total)


Fixed submission:
N = int(input())
A = list(map(int, input().split()))

mod = 10 ** 9 + 7

sum_a=0
for i in A:
    sum_a+=i
    sum_a%=mod

total=0
for i in range(N - 1):
    sum_a -= A[i]
    total+=A[i]*(sum_a)
    total%=mod
print(total)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = list(map(int, input().split()))

mod=10**9+7

total = 0
for i in range(N - 1):
    for j in range(i + 1, N):
        total += A[i]*A[j]
        total%=mod
print(total)


Fixed submission:
N = int(input())
A = list(map(int, input().split()))

mod = 10 ** 9 + 7

sum_a=0
for i in A:
    sum_a+=i
    sum_a%=mod

total=0
for i in range(N - 1):
    sum_a -= A[i]
    total+=A[i]*(sum_a)
    total%=mod
print(total)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = list(map(int, input().split()))

mod=10**9+7

total = 0
for i in range(N - 1):
    for j in range(i + 1, N):
        total += A[i]*A[j]%mod
        total%=mod
print(total)


Fixed submission:
N = int(input())
A = list(map(int, input().split()))

mod = 10 ** 9 + 7

sum_a=0
for i in A:
    sum_a+=i
    sum_a%=mod

total=0
for i in range(N - 1):
    sum_a -= A[i]
    total+=A[i]*(sum_a)
    total%=mod
print(total)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = list(map(int, input().split()))

A = list(map(lambda x: x%1000000007,A))

total = 0
for i in range(N - 1):
    for j in range(i + 1, N):
        total += A[i]*A[j] % 1000000007
print(total % 1000000007)


Fixed submission:
N = int(input())
A = list(map(int, input().split()))

mod = 10 ** 9 + 7

sum_a=0
for i in A:
    sum_a+=i
    sum_a%=mod

total=0
for i in range(N - 1):
    sum_a -= A[i]
    total+=A[i]*(sum_a)
    total%=mod
print(total)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = list(map(int, input().split()))

total = 0
for i in range(N - 1):
    for j in range(i + 1, N):
        total += ((A[i] % 1000000007) * (A[j] % 1000000007)) % 1000000007
print(total % 1000000007)


Fixed submission:
N = int(input())
A = list(map(int, input().split()))

mod = 10 ** 9 + 7

sum_a=0
for i in A:
    sum_a+=i
    sum_a%=mod

total=0
for i in range(N - 1):
    sum_a -= A[i]
    total+=A[i]*(sum_a)
    total%=mod
print(total)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A=list(map(int,input().split()))

total=0
for i in range(N-1):
    for j in range(i+1,N):
        total+=(A[i]*A[j])%(1000000007)
print(total%(1000000007))


Fixed submission:
N = int(input())
A = list(map(int, input().split()))

mod = 10 ** 9 + 7

sum_a=0
for i in A:
    sum_a+=i
    sum_a%=mod

total=0
for i in range(N - 1):
    sum_a -= A[i]
    total+=A[i]*(sum_a)
    total%=mod
print(total)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A=list(map(int,input().split()))

total=0
for i in range(N-1):
    for j in range(i+1,N):
        total+=(A[i]*A[j])%(1000000007)
print(total%(1000000007))


Fixed submission:
N = int(input())
A = list(map(int, input().split()))

mod = 10 ** 9 + 7

sum_a=0
for i in A:
    sum_a+=i
    sum_a%=mod

total=0
for i in range(N - 1):
    sum_a -= A[i]
    total+=A[i]*(sum_a)
    total%=mod
print(total)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A=list(map(int,input().split()))

total=0
for i in range(N-1):
    for j in range(i+1,N):
        total+=A[i]*A[j]
        total%=(1000000007)
print(total)


Fixed submission:
N = int(input())
A = list(map(int, input().split()))

mod = 10 ** 9 + 7

sum_a=0
for i in A:
    sum_a+=i
    sum_a%=mod

total=0
for i in range(N - 1):
    sum_a -= A[i]
    total+=A[i]*(sum_a)
    total%=mod
print(total)