#include <bits/stdc++.h>
using namespace std;
int gcd(int a, int b) { return b == 0 ? a : gcd(b, a % b); }
int main() {
  int n, m, x, y;
  cin >> n >> m >> x >> y;
  int a = gcd(x, y);
  x = x / a;
  y = y / a;
  int k = min(n / x, m / y);
  cout << k * x << " " << k * y;
}
