import strutils let read* = iterator: string = while true: (for s in stdin.readLine.split: yield s) template input*(T: static[typedesc]): untyped = when T is int: read().parseInt elif T is float: read().parseFloat elif T is string: read() elif T is char: read()[0] let N, M = input(int) if N <= M: echo 0 else: var res = 1 for i in 1 .. N: res = res * i mod M echo res