#include <bits/stdc++.h>
using namespace std;
long long a, b, x, y;
long long r;
long long gcd(long long a, long long b) { return b ? gcd(b, a % b) : a; }
long long binsearch(long long i, long long j, long long w, long long m) {
  if (i == j) {
    if (i * w <= a && i * m <= b) return i;
    return -1;
  }
  if (i == j - 1) {
    if (j * w <= a && j * m <= b) return j;
    if (i * w <= a && i * m <= b) return i;
    return -1;
  }
  long long mid = (i + j) / 2;
  if (mid * w <= a && mid * m <= b) return binsearch(mid, j, w, m);
  return binsearch(i, mid - 1, w, m);
}
int main() {
  cin >> a >> b >> x >> y;
  r = x / y;
  long long h = gcd(x, y);
  long long k = binsearch(0, 2000000000, x / h, y / h);
  if (k == -1) {
    cout << 0 << " " << 0;
    return 0;
  }
  cout << k * (x / h) << " " << k * (y / h);
  return 0;
}
