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