@@ -0,0 +1,411 @@
+n1, n2, n3 = map(int, raw_input().split(' '))%0As1, s2, s3 = %5Bmap(int, raw_input().split(' '))%5B::-1%5D for i in range(3)%5D%0A%0Asum_s1, sum_s2, sum_s3 = sum(s1), sum(s2), sum(s3)%0A%0Awhile not sum_s1 == sum_s2 == sum_s3:%0A    maxval = max(sum_s1, sum_s2, sum_s3)%0A    if sum_s1 == maxval:%0A        sum_s1 -= s1.pop()%0A    elif sum_s2 == maxval:%0A        sum_s2 -= s2.pop()%0A    else:%0A        sum_s3 -= s3.pop()%0A    %0Aprint sum_s1%0A

Create soln.py