#include <bits/stdc++.h>
using namespace std;
long long int gcd(long long int a, long long int b) {
  if (a == 0) return b;
  return gcd(b % a, a);
}
int main() {
  long long int a, b, x, y;
  cin >> a >> b >> x >> y;
  long long int d = gcd(x, y);
  x /= d;
  y /= d;
  if (a < x || b < y) {
    cout << "0 0";
    return 0;
  }
  long long int mn = min((a - a % x) / x, (b - b % y) / y);
  cout << x * mn << " " << y * mn;
}
