print(max(sum(int(n) for n in group.split('\n')) for group in open('1.in').read().rstrip().split('\n\n'))) print(sum(sorted(sum(int(n) for n in group.split('\n')) for group in open('1.in').read().rstrip().split('\n\n'))[-3:]))