#include using namespace std; int main() { int A, B; cin >> A >> B; B = abs(B); A += B * 1000; cout << A % B << endl; }