#include <bits/stdc++.h>

int main() {
  std::ios::sync_with_stdio(false);
  std::cin.tie(nullptr);
  long long A[2][2];
  for (int i = 0; i < 2; i++) {
    for (int j = 0; j < 2; j++) {
      std::cin >> A[i][j];
    }
  }
  if (A[0][0] == A[1][0] && A[1][0] == A[1][1] && A[1][1] == A[0][1] && A[0][1] == 0) {
    std::cout << "0 0\n";
    return 0;
  }
  long long D[2];
  D[0] = std::gcd(A[0][0], A[0][1]);
  for (int i = 0; i < 2; i++) {
    D[0] = std::gcd(A[1][i], D[0]);
  }
  D[1] = std::abs(A[0][0] * A[1][1] - A[0][1] * A[1][0]) / D[0];
  std::cout << D[0] << ' ' << D[1] << '\n';
}