#include using namespace std; int main() { long long p, q, x, y; cin >> p >> q >> x >> y; vector table(p + 1, 0); int now = 1; for(int i = 1; i < p; i++) { now *= 10; now %= p; table[now] = i; } long long m = y; auto chk = [&]() { if(m % 10 == 0) return false; auto s = to_string(m); reverse(s.begin(), s.end()); long long val = stoll(s); return val % p != 0; }; while(!chk()) m += q; string res = to_string(m); reverse(res.begin(), res.end()); m = stoll(res); int k = table[m % p]; int l = table[x]; if(l < k) l += p - 1; for(int i = 0; i < l - k; i++) res.push_back('0'); cout << res << endl; }