#include <bits/stdc++.h>
long long gcd(long long a, long long b) {
  if (a == 0)
    return b;
  else
    return gcd(b % a, a);
}
long long g, a, b, x, y, tempx, tempy, ansx, ansy, max = 0, area, fx, fy;
int main() {
  scanf("%I64d%I64d%I64d%I64d", &a, &b, &x, &y);
  g = gcd(x, y);
  x = x / g;
  y = y / g;
  if (x > a || y > b)
    printf("0 0\n");
  else {
    tempx = a / x;
    tempy = b / y;
    ansx = tempx * x;
    ansy = tempx * y;
    if (ansx <= a && ansy <= b) {
      area = ansx * ansy;
      if (area > max) {
        max = area;
        fx = ansx;
        fy = ansy;
      }
    }
    ansx = tempy * x;
    ansy = tempy * y;
    if (ansx <= a && ansy <= b) {
      area = ansx * ansy;
      if (area > max) {
        max = area;
        fx = ansx;
        fy = ansy;
      }
    }
    printf("%I64d %I64d\n", fx, fy);
  }
  return 0;
}
