#include <bits/stdc++.h>
using namespace std;
long long int hcf(long long int a, long long int b) {
  long long int t;
  while (a % b != 0) {
    t = a % b;
    a = b;
    b = t;
  }
  return b;
}
int main() {
  long long int i, a, b, x, y, c = 0, d = 0;
  cin >> a >> b >> x >> y;
  i = hcf(x, y);
  x = x / i;
  y = y / i;
  if (a >= x && b >= y) {
    c = a / x;
    d = b / y;
    if (c < d) {
      a = x * c;
      b = y * c;
    } else {
      a = x * d;
      b = y * d;
    }
    cout << a << " " << b;
  } else
    cout << 0 << " " << 0;
  return 0;
}
