#include <bits/stdc++.h>
using namespace std;
int a, b, x, y;
int gcd(int a, int b) {
  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 k1 = (a / x), k2 = (b / y);
  int k = min(k1, k2);
  cout << x * k << " " << y * k << endl;
}
