#include <bits/stdc++.h>
int gcd(int x, int y) { return y == 0 ? x : gcd(y, x % y); }
int main(void) {
  int a, b, x, y;
  scanf("%d%d%d%d", &a, &b, &x, &y);
  int cm = gcd(x, y);
  x /= cm;
  y /= cm;
  a /= x;
  b /= y;
  if (b < a) a = b;
  printf("%d %d\n", a * x, a * y);
}
