#include <bits/stdc++.h>
using namespace std;
int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }
int main() {
  int x, y, a, b;
  cin >> x >> y >> a >> b;
  int t = gcd(a, b);
  a /= t;
  b /= t;
  x /= a;
  y /= b;
  cout << a * min(x, y) << " " << b * min(x, y);
  cin >> a;
  return 0;
}
