#include <bits/stdc++.h>
using namespace std;
inline int gcd(int a, int b) {
  if (!b) return a;
  return gcd(b, a % b);
}
int a, b, x, y, k;
signed main() {
  scanf("%d%d%d%d", &a, &b, &x, &y);
  k = gcd(x, y);
  x /= k, y /= k;
  a = a / x, b = b / y;
  k = min(a, b);
  a = k * x, b = k * y;
  printf("%d %d\n", a, b);
  return 0;
}
