#include <bits/stdc++.h>
#pragma GCC optimize("O3")
#pragma GCC target("sse4")
using namespace std;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
long long GCD(long long u, long long v) {
  while (v != 0) {
    long long r = u % v;
    u = v;
    v = r;
  }
  return u;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  long long T = 1;
  for (long long iii = 0; iii < T; iii++) {
    long long n, m, x, y;
    cin >> n >> m >> x >> y;
    long long g = GCD(x, y);
    x = x / g;
    y = y / g;
    long long n_tmp = (n - (n % x));
    n_tmp = n_tmp / x;
    long long m_tmp = (m - (m % y));
    m_tmp = m_tmp / y;
    if (n_tmp >= m_tmp) {
      cout << m_tmp * x << " " << m_tmp * y;
    } else
      cout << n_tmp * x << " " << n_tmp * y;
  }
  cout << endl;
  return 0;
}
