import strutils, sequtils, algorithm, tables proc input: string = while true: let t = stdin.readChar if t.isSpaceAscii: break else: result.safeAdd(t) let A, B = input().parseInt var dic = initCountTable[int]() arr = newSeqWith(0, 0) for a in 0 .. A: for b in 0 .. B: dic.inc a + 5 * b for k, v in dic: if k != 0: arr.add k for v in arr.sorted(cmp): echo v