#include <bits/stdc++.h>
using namespace std;
long long gcd(long long a, long long b) { return b == 0 ? a : gcd(b, a % b); }
long long a, b, x, y;
long long best, ansp, ansq;
int main() {
  while (cin >> a >> b >> x >> y) {
    long long gg = gcd(x, y);
    x /= gg;
    y /= gg;
    best = -1;
    long long maxr = min(a / x, b / y);
    if (maxr <= 0)
      cout << 0 << " " << 0 << endl;
    else
      cout << x * maxr << " " << y * maxr << endl;
  }
}
