class solution():

def closest(self,x,tar):

finalset = []

for i in range(len(x)):

for j in range(i+1,len(x)):

for m in range(j+1,len(x)):

total = x[i]+x[j]+x[m]

finalset.append(total)

dif = abs(max(finalset))

for k in finalset:

if (abs(k-tar))<=dif:

re = k

dif =abs(k-tar)

print('The closest total is ',re)