#include <bits/stdc++.h>
using namespace std;
int gcd(int a, int b) {
  if (b == 0) return a;
  return gcd(b, a % b);
}
inline int min(int a, int b) { return a < b ? a : b; }
int main() {
  int n, m, a, b, q;
  while (scanf("%d%d%d%d", &n, &m, &a, &b) != EOF) {
    int k = gcd(a, b);
    a /= k;
    b /= k;
    q = min(n / a, m / b);
    printf("%d %d\n", a * q, b * q);
  }
  return 0;
}
