#include <bits/stdc++.h>
using namespace std;
deque<pair<pair<int, int>, int> > Q1;
deque<pair<pair<int, int>, int> > Q2;
vector<pair<pair<int, int>, int> > Hash[2][666013 + 10];
int A1, A2, B1, B2, val1, val2, Z, ZZ;
void insert(int x, int y, int val, int h) {
  long long prod = 1LL * x * y;
  long long key = prod % 666013;
  h = h - 1;
  for (vector<pair<pair<int, int>, int> >::iterator it = Hash[h][key].begin();
       it != Hash[h][key].end(); it++) {
    int a = (*it).first.first;
    int b = (*it).first.second;
    int c = (*it).second;
    long long cnt = 1LL * a * b;
    if (prod != cnt) continue;
    if (val < c) {
      (*it).first.first = x;
      (*it).first.second = y;
      (*it).second = val;
    }
    return;
  }
  Hash[h][key].push_back(make_pair(make_pair(x, y), val));
}
int query(int x, int y, int h, int &result, int &A, int &B) {
  long long prod = 1LL * x * y;
  long long key = prod % 666013;
  h = h - 1;
  for (vector<pair<pair<int, int>, int> >::iterator it = Hash[h][key].begin();
       it != Hash[h][key].end(); it++) {
    int a = (*it).first.first;
    int b = (*it).first.second;
    int c = (*it).second;
    long long cnt = 1LL * a * b;
    if (prod != cnt) continue;
    A = a;
    B = b;
    result = c;
    return 1;
  }
  return 0;
}
int main() {
  cin >> A1 >> B1 >> A2 >> B2;
  insert(A1, B1, 0, 1);
  insert(A2, B2, 0, 2);
  Q1.push_back(make_pair(make_pair(A1, B1), 0));
  Q2.push_back(make_pair(make_pair(A2, B2), 0));
  while (!Q1.empty()) {
    if (!Q1.empty()) {
      A1 = Q1.front().first.first;
      B1 = Q1.front().first.second;
      val1 = Q1.front().second;
      if (A1 % 2 == 0) {
        if (query(A1 / 2, B1, 1, val2, Z, ZZ) == 0) {
          insert(A1 / 2, B1, val1 + 1, 1);
          Q1.push_back(make_pair(make_pair(A1 / 2, B1), val1 + 1));
        }
      }
      if (B1 % 2 == 0) {
        if (query(A1, B1 / 2, 1, val2, Z, ZZ) == 0) {
          insert(A1, B1 / 2, val1 + 1, 1);
          Q1.push_back(make_pair(make_pair(A1, B1 / 2), val1 + 1));
        }
      }
      if (A1 % 3 == 0) {
        if (query(A1 / 3 + A1 / 3, B1, 1, val2, Z, ZZ) == 0) {
          insert(A1 / 3 + A1 / 3, B1, val1 + 1, 1);
          Q1.push_back(make_pair(make_pair(A1 / 3 + A1 / 3, B1), val1 + 1));
        }
      }
      if (B1 % 3 == 0) {
        if (query(A1, B1 / 3 + B1 / 3, 1, val2, Z, ZZ) == 0) {
          insert(A1, B1 / 3 + B1 / 3, val1 + 1, 1);
          Q1.push_back(make_pair(make_pair(A1, B1 / 3 + B1 / 3), val1 + 1));
        }
      }
      Q1.pop_front();
    }
  }
  while (!Q2.empty()) {
    if (!Q2.empty()) {
      A2 = Q2.front().first.first;
      B2 = Q2.front().first.second;
      val2 = Q2.front().second;
      if (query(A2, B2, 1, val1, Z, ZZ)) {
        cout << val1 + val2 << "\n";
        cout << Z << " " << ZZ << "\n";
        cout << A2 << " " << B2 << "\n";
        return 0;
      }
      if (A2 % 2 == 0) {
        if (query(A2 / 2, B2, 2, val1, Z, ZZ) == 0) {
          insert(A2 / 2, B2, val2 + 1, 2);
          Q2.push_back(make_pair(make_pair(A2 / 2, B2), val2 + 1));
        }
      }
      if (B2 % 2 == 0) {
        if (query(A2, B2 / 2, 2, val1, Z, ZZ) == 0) {
          insert(A2, B2 / 2, val2 + 1, 2);
          Q2.push_back(make_pair(make_pair(A2, B2 / 2), val2 + 1));
        }
      }
      if (A2 % 3 == 0) {
        if (query(A2 / 3 + A2 / 3, B2, 2, val1, Z, ZZ) == 0) {
          insert(A2 / 3 + A2 / 3, B2, val2 + 1, 2);
          Q2.push_back(make_pair(make_pair(A2 / 3 + A2 / 3, B2), val2 + 1));
        }
      }
      if (B2 % 3 == 0) {
        if (query(A2, B2 / 3 + B2 / 3, 2, val1, Z, ZZ) == 0) {
          insert(A2, B2 / 3 + B2 / 3, val2 + 1, 2);
          Q2.push_back(make_pair(make_pair(A2, B2 / 3 + B2 / 3), val2 + 1));
        }
      }
      Q2.pop_front();
    }
  }
  cout << -1;
  return 0;
}
