#include <bits/stdc++.h>
using namespace std;
const int MAXN = -1;
long long gcd(long long a, long long b) { return b ? gcd(b, a % b) : a; }
long long x, y;
pair<long long, long long> solve(long long a, long long b) {
  long long t = min(a / x, b / y);
  return {x * t, y * t};
}
int main() {
  long long a, b;
  while (scanf("%lld %lld", &a, &b) >= 1) {
    scanf("%lld %lld", &x, &y);
    long long g = gcd(x, y);
    x /= g;
    y /= g;
    pair<long long, long long> r1 = solve(a, b), r2 = solve(b, a);
    long long a1 = r1.first * r1.second, a2 = -1;
    printf("%lld %lld\n", a1 > a2 ? r1.first : r2.first,
           a1 > a2 ? r1.second : r2.second);
  }
  return 0;
}
