#include <bits/stdc++.h>
using namespace std;
char s[1000];
int gcd(int a, int b) { return b == 0 ? a : gcd(b, a % b); }
int main(int argc, char* argv[]) {
  int N, M;
  scanf("%d %d", &N, &M);
  int a, b;
  scanf("%d %d", &a, &b);
  int g = gcd(a, b);
  a /= g;
  b /= g;
  long long na = 0, ma = 0;
  long long m = (M / b) * b;
  long long n = (long long)m * a / b;
  if (n <= N) {
    na = n;
    ma = m;
  }
  n = (N / a) * a;
  m = (long long)n * b / a;
  if (m <= M) {
    if (na * ma < n * m) {
      na = n;
      ma = m;
    }
  }
  cout << na << ' ' << ma << endl;
  return 0;
}
