#include <bits/stdc++.h>
using namespace std;
const long inf = (1 << 25);
set<long long> s1, s2;
long long c1[10000], c2[10000];
long d1[10000], d2[10000], t1, t2;
void dfs1(long long sq, long i) {
  if (sq % 2 == 0) {
    if (s1.find(sq / 2) == s1.end()) {
      s1.insert(sq / 2);
      t1++;
      c1[t1] = sq / 2;
      d1[t1] = i + 1;
      dfs1(sq / 2, i + 1);
    }
  }
  if (sq % 3 == 0) {
    if (s1.find(sq / 3 * 2) == s1.end()) {
      s1.insert(sq / 3 * 2);
      t1++;
      c1[t1] = sq / 3 * 2;
      d1[t1] = i + 1;
      dfs1(sq / 3 * 2, i + 1);
    }
  }
}
void dfs2(long long sq, long i) {
  if (sq % 2 == 0) {
    if (s2.find(sq / 2) == s2.end()) {
      s2.insert(sq / 2);
      t2++;
      c2[t2] = sq / 2;
      d2[t2] = i + 1;
      dfs2(sq / 2, i + 1);
    }
  }
  if (sq % 3 == 0) {
    if (s2.find(sq / 3 * 2) == s2.end()) {
      s2.insert(sq / 3 * 2);
      t2++;
      c2[t2] = sq / 3 * 2;
      d2[t2] = i + 1;
      dfs2(sq / 3 * 2, i + 1);
    }
  }
}
int main() {
  long i, j, ans = inf;
  long long a1, b1, a2, b2, sqa;
  bool ff;
  scanf("%I64d%I64d", &a1, &b1);
  scanf("%I64d%I64d", &a2, &b2);
  t1 = 1;
  c1[t1] = a1 * b1;
  d1[t1] = 0;
  dfs1(a1 * b1, 0);
  t2 = 1;
  c2[t2] = a2 * b2;
  d2[t2] = 0;
  dfs2(a2 * b2, 0);
  for (i = 1; i <= t1; i++)
    for (j = 1; j <= t2; j++)
      if (c1[i] == c2[j]) {
        if (ans > d1[i] + d2[j]) {
          ans = d1[i] + d2[j];
          sqa = c1[i];
        }
      }
  if (ans == inf) {
    printf("-1\n");
    return 0;
  }
  printf("%ld\n", ans);
  s1.clear();
  s2.clear();
  t1 = t2 = 1;
  c1[1] = a1;
  c2[1] = b1;
  dfs1(a1, 0);
  dfs2(b1, 0);
  ff = false;
  for (i = 1; i <= t1; i++) {
    for (j = 1; j <= t2; j++)
      if (c1[i] * c2[j] == sqa) {
        printf("%I64d %I64d\n", c1[i], c2[j]);
        ff = true;
        break;
      }
    if (ff) break;
  }
  s1.clear();
  s2.clear();
  t1 = t2 = 1;
  c1[1] = a2;
  c2[1] = b2;
  dfs1(a2, 0);
  dfs2(b2, 0);
  ff = false;
  for (i = 1; i <= t1; i++) {
    for (j = 1; j <= t2; j++)
      if (c1[i] * c2[j] == sqa) {
        printf("%I64d %I64d\n", c1[i], c2[j]);
        ff = true;
        break;
      }
    if (ff) break;
  }
  return 0;
}
