import strutils, sequtils proc nextStr(): string = while not stdin.endOfFile: let c = stdin.readChar if c == '\r': continue if c in [' ', '\n']: break result.add(c) proc main(): void = let n, d = parseInt(nextStr()) var a = newSeqWith[n+1, [0, 0]] ans, p = 0 for i in 0..