import sequtils,algorithm,math,tables import sets,intsets,queues,heapqueue,bitops,strutils template times*(n:int,body) = (for _ in 0.." .} proc scanMod6(): int = while true: let c = getchar_unlocked() if c < '0': return result = (result * 10 + c.ord - '0'.ord) mod 6 const resStr = "428571" let n = scanMod6() if n in [0,1,3,4] : echo resStr[n] else: let m = scanMod6() if n == 5: let a = if m mod 2 == 0 : 1 else: 5 echo resStr[a] else: let a = if m mod 2 == 0 : 4 else : 2 echo resStr[a]