#include <bits/stdc++.h>
using namespace std;
long long po2(int os) {
  long long idd = 1;
  if (os == 0) return 1;
  if (os == 1) return 2;
  if (os % 2 == 0) return po2(os / 2) * po2(os / 2);
  if (os % 2) return 2 * po2((os - 1) / 2) * po2((os - 1) / 2);
}
long long po3(int os) {
  long long idd = 1;
  if (os == 0) return 1;
  if (os == 1) return 3;
  if (os % 2 == 0) return po3(os / 2) * po3(os / 2);
  if (os % 2) return 3 * po3((os - 1) / 2) * po3((os - 1) / 2);
}
int main() {
  long long l1, w1, l2, w2;
  cin >> l1 >> w1 >> l2 >> w2;
  long long s1 = l1 * w1;
  long long s2 = l2 * w2;
  int k21, k22, k31, k32;
  k21 = k22 = k31 = k32 = 0;
  long long ex = s1;
  while (ex % 2 == 0) {
    k21++;
    ex /= 2;
  }
  ex = s1;
  while (ex % 3 == 0) {
    k31++;
    ex /= 3;
  }
  ex = s2;
  while (ex % 2 == 0) {
    k22++;
    ex /= 2;
  }
  ex = s2;
  while (ex % 3 == 0) {
    k32++;
    ex /= 3;
  }
  int x, y, z, t;
  long long ans = 1000000008 * 1000000008;
  bool pos = 0;
  for (int j = 0; j <= k31; j++)
    for (int i = 0; i <= k21 + j; i++)
      for (int l = 0; l <= k32; l++)
        for (int k = 0; k <= k22 + l; k++) {
          long long com1 = ((s1 / po3(j)) * po2(j)) / po2(i);
          long long com2 = ((s2 / po3(l)) * po2(l)) / po2(k);
          if (com1 == com2) {
            if ((i + j + k + l) < ans) {
              pos = 1;
              ans = (i + j + k + l);
              x = i;
              y = j;
              z = k;
              t = l;
            }
          }
        }
  if (pos) {
    cout << ans << endl;
    while (l1 % 3 == 0 && y) {
      y--;
      l1 /= 3;
      l1 *= 2;
    }
    while (w1 % 3 == 0 && y) {
      y--;
      w1 /= 3;
      w1 *= 2;
    }
    while (l1 % 2 == 0 && x) {
      x--;
      l1 /= 2;
    }
    while (w1 % 2 == 0 && x) {
      x--;
      w1 /= 2;
    }
    while (l2 % 3 == 0 && t) {
      t--;
      l2 /= 3;
      l2 *= 2;
    }
    while (w2 % 3 == 0 && t) {
      t--;
      w2 /= 3;
      w2 *= 2;
    }
    while (l2 % 2 == 0 && z) {
      z--;
      l2 /= 2;
    }
    while (w2 % 2 == 0 && z) {
      z--;
      w2 /= 2;
    }
    cout << l1 << " " << w1 << endl;
    cout << l2 << " " << w2 << endl;
  } else
    cout << -1 << endl;
}
