#include <bits/stdc++.h>
using namespace std;
void adjust(long long &x, long long &y, long long p2, long long p3) {
  while (p3) {
    if (x % 3 == 0)
      x = x * 2 / 3;
    else
      y = y * 2 / 3;
    p3--;
  }
  while (p2) {
    if (x % 2 == 0)
      x /= 2;
    else
      y /= 2;
    p2--;
  }
}
long long gcd(long long a, long long b) {
  if (b == 0) return a;
  return gcd(b, a % b);
}
int main(void) {
  long long a[2], b[2];
  scanf("%lld %lld %lld %lld", &a[0], &a[1], &b[0], &b[1]);
  long long tot1 = a[0] * a[1], tot2 = b[0] * b[1];
  int f1[2] = {0}, f2[2] = {0};
  int ok = 1;
  while ((tot1 % 2 == 0) || (tot1 % 3 == 0)) {
    if (tot1 % 2 == 0) {
      f1[0]++;
      tot1 /= 2;
    }
    if (tot1 % 3 == 0) {
      f1[1]++;
      tot1 /= 3;
    }
  }
  while ((tot2 % 2 == 0) || (tot2 % 3 == 0)) {
    if (tot2 % 2 == 0) {
      f2[0]++;
      tot2 /= 2;
    }
    if (tot2 % 3 == 0) {
      f2[1]++;
      tot2 /= 3;
    }
  }
  long long pw1[2] = {0}, pw2[2] = {0};
  if (f1[1] > f2[1]) {
    f1[0] += f1[1] - f2[1];
    pw1[1] += f1[1] - f2[1];
  } else {
    f2[0] += f2[1] - f1[1];
    pw2[1] += f2[1] - f1[1];
  }
  if (f1[0] > f2[0])
    pw1[0] += f1[0] - f2[0];
  else if (f1[0] < f2[0])
    pw2[0] += f2[0] - f1[0];
  int ans = abs(f1[1] - f2[1]) + abs(f1[0] - f2[0]);
  adjust(a[0], a[1], pw1[0], pw1[1]);
  adjust(b[0], b[1], pw2[0], pw2[1]);
  if (a[0] * a[1] == b[0] * b[1]) {
    printf("%i\n", ans);
    printf("%lld %lld\n%lld %lld\n", a[0], a[1], b[0], b[1]);
  } else
    puts("-1");
  return 0;
}
