#include <bits/stdc++.h>
using namespace std;
long long aantal(long long a, long long b) {
  long long res = 0;
  while (a % b == 0) {
    a /= b;
    res++;
  }
  return res;
}
int main() {
  map<pair<long long, long long>, long long> bar1_sizes;
  map<pair<long long, long long>, long long> bar2_sizes;
  vector<vector<long long> > v(2, vector<long long>(2));
  for (long long i = 0; i < 2; i++) {
    for (long long j = 0; j < 2; j++) {
      cin >> v[i][j];
    }
  }
  vector<vector<vector<long long> > > macht(
      2, vector<vector<long long> >(2, vector<long long>(2, 0)));
  for (long long i = 0; i < 2; i++) {
    for (long long j = 0; j < 2; j++) {
      macht[i][j][0] = aantal(v[i][j], 2);
      macht[i][j][1] = aantal(v[i][j], 3);
    }
  }
  long long macht31 = 1;
  for (long long i = 0; i <= macht[0][0][1]; i++) {
    for (long long j = 0; j <= macht[0][0][0] + i; j++) {
      long long macht32 = 1;
      for (long long k = 0; k <= macht[0][1][1]; k++) {
        for (long long l = 0; l <= macht[0][1][0] + k; l++) {
          long long n1 = v[0][0];
          n1 /= macht31;
          n1 *= (1LL << i);
          n1 /= (1LL << j);
          long long n2 = v[0][1];
          n2 /= macht32;
          n2 *= (1LL << k);
          n2 /= (1LL << l);
          if (bar1_sizes.find(make_pair(n1, n2)) == bar1_sizes.end()) {
            bar1_sizes[make_pair(n1, n2)] = i + j + k + l;
          } else {
            bar1_sizes[make_pair(n1, n2)] =
                min(bar1_sizes[make_pair(n1, n2)], i + j + k + l);
          }
        }
        macht32 *= 3;
      }
    }
    macht31 *= 3;
  }
  macht31 = 1;
  for (long long i = 0; i <= macht[1][0][1]; i++) {
    for (long long j = 0; j <= macht[1][0][0] + i; j++) {
      long long macht32 = 1;
      for (long long k = 0; k <= macht[1][1][1]; k++) {
        for (long long l = 0; l <= macht[1][1][0] + k; l++) {
          long long n1 = v[1][0];
          n1 /= macht31;
          n1 *= (1LL << i);
          n1 /= (1LL << j);
          long long n2 = v[1][1];
          n2 /= macht32;
          n2 *= (1LL << k);
          n2 /= (1LL << l);
          if (bar2_sizes.find(make_pair(n1, n2)) == bar2_sizes.end()) {
            bar2_sizes[make_pair(n1, n2)] = i + j + k + l;
          } else {
            bar2_sizes[make_pair(n1, n2)] =
                min(bar2_sizes[make_pair(n1, n2)], i + j + k + l);
          }
        }
        macht32 *= 3;
      }
    }
    macht31 *= 3;
  }
  map<long long, pair<int, pair<long long, long long> > > needed;
  for (auto it = bar1_sizes.begin(); it != bar1_sizes.end(); it++) {
    long long x = (it->first).first;
    long long y = (it->first).second;
    long long sz = x * y;
    int moves = it->second;
    if (needed.find(sz) == needed.end()) {
      needed[sz] = make_pair(moves, make_pair(x, y));
    } else {
      needed[sz] = min(needed[sz], make_pair(moves, make_pair(x, y)));
    }
  }
  pair<int, pair<pair<long long, long long>, pair<long long, long long> > >
      kleinste =
          make_pair(100000, make_pair(make_pair(-1, -1), make_pair(-1, -1)));
  for (auto it = bar2_sizes.begin(); it != bar2_sizes.end(); it++) {
    long long x = (it->first).first;
    long long y = (it->first).second;
    long long sz = x * y;
    int moves = it->second;
    if (needed.find(sz) == needed.end()) {
      continue;
    } else {
      kleinste = min(kleinste,
                     make_pair(moves + needed[sz].first,
                               make_pair(needed[sz].second, make_pair(x, y))));
    }
  }
  if (kleinste.first == 100000) {
    cout << "-1" << endl;
    return 0;
  }
  cout << kleinste.first << endl;
  cout << kleinste.second.first.first << " " << kleinste.second.first.second
       << endl;
  cout << kleinste.second.second.first << " " << kleinste.second.second.second
       << endl;
  return 0;
}
