var n, m, a, b: integer;
    r, h: integer;
    maxx, mr, mh: integer;
begin
readln(n);
readln(m);
readln(a);
readln(b);

maxx := 0;
for r :=1 to n do
    for h := 1 to m do
        if (r mod a = 0) and (h mod b = 0) or (r mod b = 0) and (h mod a = 0) then
            if ((r + h) mod 2 <> 0) and (r + h > maxx) then
            begin
                maxx := r + h;
                mr := r;
                mh := h;
            end;
writeln(mr, ' ', mh);
end.