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