#include "bits/stdc++.h" #define in std::cin #define out std::cout #define rep(i,N) for(LL i=0;i> N >> M; if (N >= M) { out << 0 << std::endl; return 0; } LL ans = 1; for (LL i = 1; i <= N; ++i) (ans *= i % M) %= M; out << ans << std::endl; }