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