#include <bits/stdc++.h>
using namespace std;
vector<int> digits(10);
long long int gcd(long long int a, long long int b) {
  if (b == 0)
    return a;
  else {
    return gcd(b, a % b);
  }
}
int main() {
  long long int a, b, x, y, k, i = 2, l;
  cin >> a >> b >> x >> y;
  if (x > y) {
    l = gcd(x, y);
    x = x / l;
    y = y / l;
  } else {
    l = gcd(y, x);
    x = x / l;
    y = y / l;
  }
  if ((a < x) || (b < y))
    cout << "0 0";
  else {
    k = 1;
    while (((x * k) <= a) && ((y * k) <= b)) {
      k++;
    }
    cout << x * (k - 1) << " " << y * (k - 1);
  }
}
