#include <bits/stdc++.h>
using namespace std;
int a, b, x, y;
int gcd(int a, int b) {
  if (a < b) return gcd(b, a);
  if (b == 0) return a;
  return gcd(b, a % b);
}
int main() {
  cin >> a >> b >> x >> y;
  int g = gcd(x, y);
  x /= g, y /= g;
  int maxk = min(a / x, b / y);
  if (maxk == 0) {
    cout << "0 0";
  } else {
    cout << x * maxk << " " << y * maxk << endl;
  }
  return 0;
}
