#include using namespace std; typedef long long ll; int main() { ll L,R,C; cin>>L>>R>>C; ll cnt; ll m=INT_MAX; for(ll i=L;i<=R;i++) { cnt=1000-(i*C)%1000; if(cnt