#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, c, d;
  scanf("%d%d%d%d", &a, &b, &c, &d);
  int g = gcd(c, d);
  c /= g;
  d /= g;
  int x = a / c, y = b / d;
  int minn = min(x, y);
  int a2 = minn * c, b2 = minn * d;
  if (a2 <= a && b2 <= b)
    printf("%d %d\n", a2, b2);
  else
    printf("0 0\n");
  return 0;
}
