import sequtils, strutils let input = stdin.lines.toSeq n = parseInt input[0] seq1 = input[1..^1] if seq1.len != n: echo $'"' & "assert" & $'"' quit() let xs = seq1.map parseInt var a, b, c = 0 for x in xs: var tmp = x if tmp > a: swap(tmp, a) if tmp > b: swap(tmp, b) if tmp > c and (a != b or tmp != b): swap(tmp, c) if b == c: echo b + c else: echo a + c