import itertools
d=[]
with open("105_sets.txt") as f:
for line in f:
d.append(sorted([int(i) for i in line.split(",")]))
def dss(s):
v=set([])
for i in range(1,len(s)+1):
for t in itertools.combinations(s,i):
x=sum(t)
if x in v:
return False
else:
v.add(x)
return True
print sum(sum(s) for s in d if all(sum(s[:k])>sum(s[1-k:]) for k in range(2,(len(s)+1)/2+1)) and dss(s))