from sys import stdin best = [] done = False while not done: done = True total = 0 for line in stdin: done = False line = line.strip() if line == "": break total += int(line) best = sorted([total] + best)[-3:] print(best[-1], sum(best))