#include #include using i64 = int64_t; int main(void) { i64 M; scanf("%ld", &M); i64 res = static_cast(-__uint128_t(M) % M); printf("%ld\n", res); return 0; }