#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int n, m, x, y, d;
  cin >> n >> m >> x >> y;
  vector<long long int> v;
  d = x;
  if (x < y) d = y;
  long long int a = sqrt(d);
  for (long long int i = 1; i <= a; i++) {
    if (d % i == 0) {
      v.push_back(i);
      v.push_back(d / i);
    }
  }
  long long int ans = 1;
  sort(v.begin(), v.end(), greater<long long int>());
  for (long long int i = 0; i < v.size(); i++) {
    if (!(x % v[i]) and !(y % v[i])) {
      ans = v[i];
      break;
    }
  }
  x /= ans;
  y /= ans;
  long long int mx = min(n / x, m / y);
  cout << mx * x << " " << mx * y << endl;
}
