#include <bits/stdc++.h>
using namespace std;
int main() {
  int a1, b1, a2, b2;
  scanf("%d%d%d%d", &a1, &b1, &a2, &b2);
  int i;
  int two1 = 0, three1 = 0, two2 = 0, three2 = 0;
  long long s1 = (long long)a1 * b1, s2 = (long long)a2 * b2;
  while (!(s1 % 2)) {
    two1++;
    s1 /= 2;
  }
  while (!(s1 % 3)) {
    three1++;
    s1 /= 3;
  }
  while (!(s2 % 2)) {
    two2++;
    s2 /= 2;
  }
  while (!(s2 % 3)) {
    three2++;
    s2 /= 3;
  }
  int t1 = 0, th1 = 0, t2 = 0, th2 = 0;
  if (s1 != s2) {
    printf("-1\n");
    return 0;
  }
  int ans = 0;
  while (three1 > three2) {
    three1--;
    th1++;
    two1++;
    t1--;
    ans++;
    if (a1 % 3 == 0) {
      a1 /= 3;
      a1 *= 2;
    } else if (b1 % 3 == 0) {
      b1 /= 3;
      b1 *= 2;
    }
  }
  while (three1 < three2) {
    three2--;
    th2++;
    two2++;
    t2--;
    ans++;
    if (a2 % 3 == 0) {
      a2 /= 3;
      a2 *= 2;
    } else if (b2 % 3 == 0) {
      b2 /= 3;
      b2 *= 2;
    } else {
      puts("-1");
      return 0;
    }
  }
  while (two1 > two2) {
    two1--;
    t1++;
    ans++;
    if (a1 % 2 == 0) {
      a1 /= 2;
    } else if (b1 % 2 == 0) {
      b1 /= 2;
    } else {
      puts("-1");
      return 0;
    }
  }
  while (two1 < two2) {
    two2--;
    t2++;
    ans++;
    if (a2 % 2 == 0) {
      a2 /= 2;
    } else if (b2 % 2 == 0) {
      b2 /= 2;
    } else {
      puts("-1");
      return 0;
    }
  }
  cout << ans << endl;
  printf("%d %d\n", a1, b1);
  printf("%d %d\n", a2, b2);
  return 0;
}
