P, Q, x, y = map(int, input().split()) while y % 10 == 0 or int(str(y)[::-1]) % P == 0: y += Q n = str(y)[::-1] r = int(n) % P zero = 0 while r != x: r *= 10 zero += 1 r %= P print(n + "0" * zero)