#include <bits/stdc++.h>
using namespace std;
unsigned long long a, b, x, y, d, l, r = 2 * (int)1e9 + 3, m;
unsigned long long gcd(unsigned long long a, unsigned long long b) {
  return !b ? a : gcd(b, a % b);
}
int main() {
  scanf("%I64d%I64d%I64d%I64d", &a, &b, &x, &y);
  d = gcd(x, y);
  x /= d, y /= d;
  while (l <= r) {
    m = (l + r) / 2;
    if (x * m <= a && y * m <= b)
      l = m + 1;
    else
      r = m - 1;
  }
  printf("%I64d %I64d", (l - 1) * x, (l - 1) * y);
  return 0;
}
