var n, m, a, b: integer;
    kra, krb, kha, khb: integer;
    k, mm: integer;
    maxx, mr, mh: integer;
begin
readln(n);
readln(m);
readln(a);
readln(b);
mm := a;
if b < mm then mm := a;
if (n < mm) or (m < mm) then
   writeln(0, ' ', 0)
else
begin
    kra := n div a;
    krb := n div b;
    kha := m div a;
    khb := m div b;
    maxx := 0;
    k := kra * a + khb * b;
    if (k mod 2 <> 0) and (k > maxx) then
    begin
        maxx := k;
        mr := kra * a;
        mh := khb * b;
    end;
    k := (kra - 1) * a + khb * b;
    if (kra > 1) and (k mod 2 <> 0) and (k > maxx) then
    begin
        maxx := k;
        mr := (kra - 1) * a;
        mh := khb * b;
    end;
    k := kra * a + (khb - 1) * b;
    if (khb > 1) and (k mod 2 <> 0) and (k > maxx) then
    begin
        maxx := k;
        mr := kra * a;
        mh := (khb - 1) * b;
    end;
    
    k := krb * b + kha * a;
    if (k mod 2 <> 0) and (k > maxx) then
    begin
        maxx := k;
        mr := krb * b;
        mh := kha * a;
    end;
    k := (krb - 1) * b + kha * a;
    if (krb > 1) and (k mod 2 <> 0) and (k > maxx) then
    begin
        maxx := k;
        mr := (krb - 1) * b;
        mh := kha * a;
    end;
    k := krb * b + (kha - 1) * a;
    if (kha > 1) and (k mod 2 <> 0) and (k > maxx) then
    begin
        maxx := k;   
        mr := krb * b;
        mh := (kha - 1)  * a;
    end;
    if maxx = 0 then
    begin
        mr := 0;
        mh := 0;
    end;
    write(mr, ' ', mh);
end;
end.