#include using namespace std; int main() { uint64_t m; cin >> m; uint64_t ans = static_cast(-__uint128_t(m) % m); cout << ans << '\n'; return 0; }