15 lines
302 B
Python

from functools import reduce
def product(p, q):
multi = 0
while True:
q.pop(0)
if not q:
break
multi += reduce(lambda x, y: x + y[0] * y[1], zip(p, q), 0)
return multi
limit = 10000 + 1
print(2 * product(list(range(1, limit)), list(range(1, limit))))