#include <bits/stdc++.h>
using namespace std;
int gcd(int a, int b) {
  while (b) b ^= a ^= b ^= 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 ka = a / x;
  int kb = b / y;
  int m = min(ka, kb);
  cout << m * x << " " << m * y;
  return 0;
}
