#include <bits/stdc++.h>
using namespace std;
map<int, int> R;
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() {
  long long a, b, x, y, i, j, g, t;
  cin >> a >> b >> x >> y;
  g = gcd(x, y);
  x = x / g, y = y / g;
  if (a < x || b < y) {
    cout << "0 0";
  } else {
    t = min(a / x, b / y);
    a = x * t, b = y * t;
    cout << a << " " << b;
  }
}
