#include <bits/stdc++.h>
using namespace std;
int main() {
  long long a1, b1, a2, b2;
  int step1 = 0, step2 = 0;
  cin >> a1 >> b1 >> a2 >> b2;
  long long size1 = a1 * b1, size2 = a2 * b2;
  while (size1 % 2 == 0) size1 /= 2;
  while (size1 % 3 == 0) size1 /= 3;
  while (size2 % 2 == 0) size2 /= 2;
  while (size2 % 3 == 0) size2 /= 3;
  if (size1 - size2) {
    cout << -1 << endl;
    return 0;
  }
  long long fsize = size1;
  while ((a1 * b1 / fsize % 2 == 0) && (a2 * b2 / fsize % 2 == 0)) fsize *= 2;
  while ((a1 * b1 / fsize % 3 == 0) && (a2 * b2 / fsize % 3 == 0)) fsize *= 3;
  while ((a1 * b1 / fsize % 3 == 0) && (a2 * b2 / fsize % 2 == 0)) {
    ++step1;
    if (a1 % 3 == 0)
      a1 = a1 / 3 * 2;
    else
      b1 = b1 / 3 * 2;
    fsize *= 2;
  }
  while ((a2 * b2 / fsize % 3 == 0) && (a1 * b1 / fsize % 2 == 0)) {
    ++step2;
    if (a2 % 3 == 0)
      a2 = a2 / 3 * 2;
    else
      b2 = b2 / 3 * 2;
    fsize *= 2;
  }
  while (a1 * b1 / fsize % 3 == 0) {
    if (a1 % 3 == 0)
      a1 = a1 / 3 * 2;
    else
      b1 = b1 / 3 * 2;
    ++step1;
  }
  while (a1 * b1 / fsize % 2 == 0) {
    if (a1 % 2 == 0)
      a1 = a1 / 2;
    else
      b1 = b1 / 2;
    ++step1;
  }
  while (a2 * b2 / fsize % 3 == 0) {
    if (a2 % 3 == 0)
      a2 = a2 / 3 * 2;
    else
      b2 = b2 / 3 * 2;
    ++step2;
  }
  while (a2 * b2 / fsize % 2 == 0) {
    if (a2 % 2 == 0)
      a2 = a2 / 2;
    else
      b2 = b2 / 2;
    ++step2;
  }
  cout << step1 + step2 << endl;
  cout << a1 << ' ' << b1 << endl;
  cout << a2 << ' ' << b2 << endl;
}
