import strutils, math proc pInt(s: auto): int = parseInt($s) proc input(): 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 a, n = pInt(input()) var m = 1 k = 0 ans: int while m < 10^7: m *= a k += 1 if k <= n: ans = 0 else: ans = a^n echo m echo ans when isMainModule: main()