with open('2_input.txt') as f: lst = [[int(i) for i in line.split()] for line in f] print(sum(max(line) - min(line) for line in lst))