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