#include <bits/stdc++.h>
using namespace std;
int gcd(int a, int b) {
  if (b == 0) return a;
  return gcd(b, a % b);
}
int main() {
  int a, b, x, y;
  cin >> a >> b >> x >> y;
  int gcdxy = gcd(x, y);
  x /= gcdxy;
  y /= gcdxy;
  if (x > a || y > b)
    cout << "0 0" << endl;
  else {
    int ax = a / x, by = b / y;
    int mini = min(ax, by);
    cout << x * mini << " " << y * mini << endl;
  }
  return 0;
}
