n = int(input())
m = int(input())
a = int(input())
b = int(input())
maxx = 0
for r in range(1, n + 1):
    for h in range(1, m + 1):
        if r % a == 0 and h % b == 0 or r % b == 0 and h % a == 0:
            if (r + h) % 2 != 0 and r + h > maxx:
                maxx = r + h
                rm = r
                hm = h
if maxx == 0:
    rm = 0
    hm = 0
print(rm, hm)