p,q,x,y = map(int,input().split()) now = y while True: cand = int(str(now)[::-1]) if cand%p: break now += q for i in range(p): if pow(10,i,p) == cand%p: k = i break for i in range(k,k+p): if pow(10,i,p) == x: l = i break print(pow(10,l-k)*cand)