#include <iostream>
#include <string>

/* run this program using the console pauser or add your own getch, system("pause") or input loop */
using namespace std;

int main(int argc, char** argv) {
    int n, m, a, b;
    cin >> n >> m >> a >> b;
	if (n < min(a, b) or m < min(a, b))
	   cout << 0 << " " << 0;
	else
	{
	    int kra = n / a;
	    int krb = n / b;
	    int kha = m / a;
	    int khb = m / b;
	    int maxx = 0;
	    int mr, mh;
	    int 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;
	    }
	    cout << mr << " " << mh;
	}
	return 0;
}
