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