#include <bits/stdc++.h>
using namespace std;
#pragma comment(linker, "/STACK:102400000,102400000")
long long a, b, x, y;
long long gcd(long long a, long long b) {
  if (b == 0)
    return a;
  else
    return gcd(b, a % b);
}
int main() {
  while (scanf("%I64d %I64d %I64d %I64d", &a, &b, &x, &y) != EOF) {
    long long g = gcd(x, y);
    x /= g;
    y /= g;
    long long t1 = a / x;
    long long t2 = b / y;
    if (a < x || b < y) {
      printf("0 0\n");
    } else if (b * x > a * y) {
      printf("%I64d %I64d\n", t1 * x, t1 * y);
    } else if (b * x < a * y) {
      printf("%I64d %I64d\n", t2 * x, t2 * y);
    } else
      printf("%I64d %I64d\n", a, b);
  }
  return 0;
}
