#include <iostream>
using namespace std;
int main() {
int A,B,K,N;
cin>>A>>B>>K>>N;
for(int i=A; i<=B; i++){
if (i%K==0 and i%N!=0){
cout<<i<<endl;
}
}
return 0;
}
I2luY2x1ZGUgPGlvc3RyZWFtPgp1c2luZyBuYW1lc3BhY2Ugc3RkOwoKaW50IG1haW4oKSB7CglpbnQgQSxCLEssTjsKCWNpbj4+QT4+Qj4+Sz4+TjsKCWZvcihpbnQgaT1BOyBpPD1COyBpKyspewoJCWlmIChpJUs9PTAgYW5kIGklTiE9MCl7CgkJCWNvdXQ8PGk8PGVuZGw7CgkJfQoJfQoJcmV0dXJuIDA7Cn0=