#include using namespace std; using ll=long long; int main(){ ll A,B,a,b; cin>>A>>B>>a>>b; for(ll x=0;x<=10000000;x++){ if(x%A==a&&x%B==b){ cout<