#include <bits/stdc++.h>
int main() {
  int GCD(int x, int y);
  int MIN(int a, int b);
  int a, b, x, y;
  scanf("%d%d%d%d", &a, &b, &x, &y);
  int gcd = GCD(x, y);
  x = x / gcd;
  y = y / gcd;
  int m = MIN(a / x, b / y);
  printf("%d %d", m * x, m * y);
}
int GCD(int x, int y) {
  int gcd = x % y;
  while (gcd) {
    x = y;
    y = gcd;
    gcd = x % y;
  }
  return y;
}
int MIN(int a, int b) {
  if (a >= b)
    return b;
  else
    return a;
}
