# William M. Farmer and Spencer Smith
# doubleSum.py
# 29 January 2013

a = [1, 3, 4, 5, 6]
b = [2, 4, 5, 1, 6, 8]

num = 0
for i in range(len(a)):
	for j in range(len(b)):
		num = num + a[i]*b[j]
print num

numa = 0
for i in range(len(a)):
	numa = numa + a[i]

numb = 0
for i in range(len(b)):
	numb = numb + b[i]

num = numa*numb
	
print num

# The same can be done without the range function
# The body of the loop happens for each entry in the list

num = 0
for i in a:
	for j in b:
		num = num + i*j
print num