import math proc getchar_unlocked():char {. importc:"getchar_unlocked",header: "" .} proc scan(): int = while true: var k = getchar_unlocked() if k < '0': break result = 10 * result + k.ord - '0'.ord let n = scan() let n2 = n * (n + 1) div 2 let n3 = n2 + n echo n2.gcd(n3)