#include <bits/stdc++.h>
using namespace std;
const long long oo = 1e20;
const int maxSize = 100100;
const int mod = 100000000;
const double EPS = (1e-9);
int dcmp(double x, double y) { return fabs(x - y) <= EPS ? 0 : x < y ? -1 : 1; }
int a1, b1, a2, b2;
long long ans = oo;
pair<int, int> r1, r2;
map<long long, pair<int, pair<int, int> > > seq1, seq2;
void rec1(int step, int n, int m) {
  if (seq1.find(1ll * n * m) == seq1.end())
    seq1[1ll * n * m] = make_pair(step, make_pair(n, m));
  else if (seq1[1ll * n * m].first > step)
    seq1[1ll * n * m] = make_pair(step, make_pair(n, m));
  else
    return;
  if (n % 2 == 0) rec1(step + 1, n / 2, m);
  if (n % 3 == 0) rec1(step + 1, 2 * n / 3, m);
  if (m % 2 == 0) rec1(step + 1, n, m / 2);
  if (m % 3 == 0) rec1(step + 1, n, 2 * m / 3);
}
void rec2(int step, int n, int m) {
  if (seq2.find(1ll * n * m) == seq2.end())
    seq2[1ll * n * m] = make_pair(step, make_pair(n, m));
  else if (seq2[1ll * n * m].first > step)
    seq2[1ll * n * m] = make_pair(step, make_pair(n, m));
  else
    return;
  if (seq1.find(1ll * n * m) != seq1.end()) {
    pair<int, pair<int, int> > res1 = seq1[1ll * n * m],
                               res2 = seq2[1ll * n * m];
    if (res1.first + res2.first < ans) {
      ans = res1.first + res2.first;
      r1 = res1.second;
      r2 = res2.second;
    }
  }
  if (n % 2 == 0) rec2(step + 1, n / 2, m);
  if (n % 3 == 0) rec2(step + 1, 2 * n / 3, m);
  if (m % 2 == 0) rec2(step + 1, n, m / 2);
  if (m % 3 == 0) rec2(step + 1, n, 2 * m / 3);
}
int main() {
  cin >> a1 >> b1;
  cin >> a2 >> b2;
  rec1(1, a1, b1);
  rec2(1, a2, b2);
  if (ans == oo) {
    cout << -1;
    return 0;
  }
  cout << ans - 2 << endl;
  cout << r1.first << " " << r1.second << endl;
  cout << r2.first << " " << r2.second << endl;
}
