#include <bits/stdc++.h>
using namespace std;
long long gcd(long long n, long long m) {
  if (m == 0) return n;
  return gcd(m, n % m);
}
int main() {
  long long a, b, x, y;
  while (scanf("%lld%lld%lld%lld", &a, &b, &x, &y) != EOF) {
    long long num = gcd(x, y);
    x = x / num;
    y = y / num;
    a = a / x;
    b = b / y;
    long long minn = min(a, b);
    x = x * minn;
    y = y * minn;
    printf("%lld %lld\n", x, y);
  }
  return 0;
}
