n = int(input())
m = int(input())
a = int(input())
b = int(input())
if n < min(a, b) or m < min(a, b):
    print(0, 0)
else:
    kra = n // a
    krb = n // b
    kha = m // a
    khb = m // b
    maxx = 0
    k = kra * a + khb * b
    if k % 2 != 0 and k > maxx:
        maxx = k
        mr = kra * a
        mh = khb * b
    k = (kra - 1) * a + khb * b
    if kra > 1 and k % 2 != 0 and k > maxx:
        maxx = k
        mr = (kra - 1) * a
        mh = khb * b
    k = kra * a + (khb - 1) * b
    if khb > 1 and k % 2 != 0 and k > maxx:
        maxx = k
        mr = kra * a
        mh = (khb - 1) * b
    
    k = krb * b + kha * a
    if k % 2 != 0 and k > maxx:
        maxx = k
        mr = krb * b
        mh = kha * a
    k = (krb - 1) * b + kha * a
    if krb > 1 and k % 2 != 0 and k > maxx:
        maxx = k
        mr = (krb - 1) * b
        mh = kha * a
    k = krb * b + (kha - 1) * a
    if kha > 1 and k % 2 != 0 and k > maxx:
        maxx = k   
        mr = krb * b
        mh = (kha - 1)  * a
    if maxx == 0:
        mr = 0
        mh = 0
    print(mr, mh)
    