#include <iostream> using namespace std; int main() { int r,l,x; cin>>l>>r>>x; if(!(l%x))cout<<l;//判断l是不是倍数 else if((l/x)*x+x<=r)cout<<(l/x)*x+x;//l不是倍数时,判断第一个比l大的x的倍数是否在区间内 else cout<<"-1";//没有,-1 } // 64 位输出请用 printf("%lld")