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