#include <bits/stdc++.h>
long long i, j, a, b, t, x, y, a1, a2, b1, b2, t1, t2, r1, r2, g;
int gys(int a, int b) {
  int t, s;
  if (a < b) t = a, a = b, b = t;
  while ((s = a % b) != 0) {
    a = b, b = s;
  }
  return b;
}
int main() {
  while (scanf("%I64d%I64d%I64d%I64d", &a, &b, &x, &y) != EOF) {
    r1 = r2 = 0;
    g = gys(x, y);
    x /= g, y /= g;
    t1 = a / x;
    t2 = b / y;
    if (b >= t1 * y) r1 = t1;
    if (a >= t2 * x) r2 = t2;
    a1 = r1 * x, b1 = r1 * y;
    a2 = r2 * x, b2 = r2 * y;
    if (a1 * b1 > a2 * b2)
      printf("%I64d %I64d\n", a1, b1);
    else
      printf("%I64d %I64d\n", a2, b2);
  }
  return 0;
}
