Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np

N = int(input())
A = list(map(int, input().split(' ')))

modn = int(1e9 + 7)

A = np.mod(A, modn)

ruiseki = []
for i in range(len(A)-1):
    tmp_sum = sum(A[i+1:len(A)])
    ruiseki.append(tmp_sum)

ret = 0
for i in range(0, len(A)-1):
  ret += A[i] * ruiseki[i]

print(np.mod(ret, modn))

Fixed submission:
import numpy as np

N = int(input())
A = list(map(int, input().split(' ')))

modn = int(1e9 + 7)

ruiseki = sum(A)

ret = 0
for i in range(0, len(A)-1):
  ruiseki -= A[i]
  ret += A[i] * ruiseki

print(np.mod(ret, modn))

Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np

N = int(input())
A = list(map(int, input().split(' ')))

modn = int(1e9 + 7)

A = np.mod(A, modn)

ret = 0
for i in range(0, len(A)-1):
  sub_sum = 0
  for j in range(i+1, len(A)):
    sub_sum += A[j]
  ret += np.mod(A[i] * sub_sum, modn)

print(np.mod(ret, modn))


Fixed submission:
import numpy as np

N = int(input())
A = list(map(int, input().split(' ')))

modn = int(1e9 + 7)

ruiseki = sum(A)

ret = 0
for i in range(0, len(A)-1):
  ruiseki -= A[i]
  ret += A[i] * ruiseki

print(np.mod(ret, modn))

Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np

N = int(input())
A = list(map(int, input().split(' ')))

modn = int(1e9 + 7)

A = np.mod(A, modn)

ret = 0
for i in range(0, len(A)-1):
  for j in range(i+1, len(A)):
    ret += A[i]*A[j]

print(np.mod(ret, modn))


Fixed submission:
import numpy as np

N = int(input())
A = list(map(int, input().split(' ')))

modn = int(1e9 + 7)

ruiseki = sum(A)

ret = 0
for i in range(0, len(A)-1):
  ruiseki -= A[i]
  ret += A[i] * ruiseki

print(np.mod(ret, modn))

Buggy python submission (verdict: Runtime Error):
N = int(input())
A = list(map(int, input().split(' ')))

modn = int(1e9 + 7)

A = np.mod(A, modn)

ret = 0
for i in range(0, len(A)-1):
  for j in range(i+1, len(A)):
    ret += A[i]*A[j]

print(np.mod(ret, modn))


Fixed submission:
import numpy as np

N = int(input())
A = list(map(int, input().split(' ')))

modn = int(1e9 + 7)

ruiseki = sum(A)

ret = 0
for i in range(0, len(A)-1):
  ruiseki -= A[i]
  ret += A[i] * ruiseki

print(np.mod(ret, modn))

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

modn = int(1e9 + 7)

ret = 0
for i in range(0, len(A)-1):
  for j in range(i+1, len(A)):
    ret += A[i]*A[j] % modn


print(ret % modn)


Fixed submission:
import numpy as np

N = int(input())
A = list(map(int, input().split(' ')))

modn = int(1e9 + 7)

ruiseki = sum(A)

ret = 0
for i in range(0, len(A)-1):
  ruiseki -= A[i]
  ret += A[i] * ruiseki

print(np.mod(ret, modn))

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

ret = 0
for i in range(0, len(A)-1):
  for j in range(i+1, len(A)):
    ret += A[i]*A[j]

modn = int(1e9 + 7)
print(ret % modn)

Fixed submission:
import numpy as np

N = int(input())
A = list(map(int, input().split(' ')))

modn = int(1e9 + 7)

ruiseki = sum(A)

ret = 0
for i in range(0, len(A)-1):
  ruiseki -= A[i]
  ret += A[i] * ruiseki

print(np.mod(ret, modn))