#include <bits/stdc++.h>
using namespace std;
long long gcd(long long a, long long b) {
  return (a && b) ? gcd(b, a % b) : a + b;
}
int main() {
  long long a, b, x, y;
  cin >> a >> b >> x >> y;
  long long l = 0, r = (long long)2.1e9;
  long long g = gcd(x, y);
  x /= g;
  y /= g;
  while (r - l > 1) {
    long long m = (r + l) / 2;
    if ((m * x <= a && m * y <= b)) {
      l = m;
    } else {
      r = m;
    }
  }
  cout << l * x << " " << l * y << endl;
  return 0;
}
