#include <bits/stdc++.h>
using namespace std;
long long gcd(long long x, long long y) {
  if (x % y == 0) return y;
  return gcd(y, x % y);
}
int main() {
  long long a, b, x, y;
  cin >> a >> b >> x >> y;
  long long g = gcd(x, y);
  x /= g;
  y /= g;
  a -= a % x;
  b -= b % y;
  long long ans = -1;
  bool flag = true;
  if (a / x * y <= b) ans = a / x * y * a;
  if (b / y * x <= a) {
    if (ans < b / y * x * b) {
      ans = b / y * x * b;
      flag = false;
    }
  }
  if (ans == -1) {
    cout << 0 << " " << 0 << endl;
  } else if (flag) {
    cout << a << " " << a / x * y << endl;
  } else {
    cout << b / y * x << " " << b << endl;
  }
}
