#include <bits/stdc++.h>
using namespace std;
struct node {
  long long x, y, dis;
  node(long long x = 0, long long y = 0, long long dis = 0)
      : x(x), y(y), dis(dis) {}
};
long long n1, m1, n2, m2;
map<long long, int> chk;
map<long long, pair<int, int> > ans;
void pre() {
  queue<node> q;
  chk[n1 * m1] = 1;
  ans[n1 * m1] = make_pair(n1, m1);
  q.push(node(n1, m1, 1));
  while (!q.empty()) {
    node cur = q.front();
    q.pop();
    long long x = cur.x, y = cur.y, dis = cur.dis;
    if (cur.x % 2 == 0) {
      long long nex = x * y / 2;
      if (chk[nex] == 0) {
        chk[nex] = dis + 1;
        ans[nex] = make_pair(x / 2, y);
        q.push(node(x / 2, y, dis + 1));
      }
    }
    if (cur.x % 3 == 0) {
      long long nex = x * 2 * y / 3;
      if (chk[nex] == 0) {
        chk[nex] = dis + 1;
        ans[nex] = make_pair(x * 2 / 3, y);
        q.push(node(x * 2 / 3, y, dis + 1));
      }
    }
    if (cur.y % 2 == 0) {
      long long nex = x * y / 2;
      if (chk[nex] == 0) {
        chk[nex] = dis + 1;
        ans[nex] = make_pair(x, y / 2);
        q.push(node(x, y / 2, dis + 1));
      }
    }
    if (cur.y % 3 == 0) {
      long long nex = x * y * 2 / 3;
      if (chk[nex] == 0) {
        chk[nex] = dis + 1;
        ans[nex] = make_pair(x, y * 2 / 3);
        q.push(node(x, y * 2 / 3, dis + 1));
      }
    }
  }
}
map<long long, bool> vis;
void bfs() {
  int cur = 2147483647, x1, y1, x2, y2;
  queue<node> q;
  q.push(node(n2, m2, 1));
  if (chk[n2 * m2]) {
    cur = chk[n2 * m2] - 1;
    x1 = ans[n2 * m2].first, y1 = ans[n2 * m2].second, x2 = n2, y2 = m2;
  }
  while (!q.empty()) {
    node u = q.front();
    q.pop();
    long long x = u.x, y = u.y;
    int dis = u.dis;
    if (x % 2 == 0) {
      if (vis[x * y / 2] == 0) {
        vis[x * y / 2] = 1;
        q.push(node(x / 2, y, dis + 1));
        if (chk[x * y / 2] && cur > chk[x * y / 2] + dis - 1) {
          cur = chk[x * y / 2] + dis - 1;
          x1 = ans[x * y / 2].first, y1 = ans[x * y / 2].second, x2 = x / 2,
          y2 = y;
        }
      }
    }
    if (x % 3 == 0) {
      if (vis[x * 2 * y / 3] == 0) {
        vis[x * 2 * y / 3] = 1;
        q.push(node(x * 2 / 3, y, dis + 1));
        if (chk[x * 2 * y / 3] && cur > chk[x * 2 * y / 3] + dis - 1) {
          cur = chk[x * 2 * y / 3] + dis - 1;
          x1 = ans[x * 2 * y / 3].first, y1 = ans[x * 2 * y / 3].second,
          x2 = x * 2 / 3, y2 = y;
        }
      }
    }
    if (y % 2 == 0) {
      if (vis[x * y / 2] == 0) {
        vis[x * y / 2] = 1;
        q.push(node(x, y / 2, dis + 1));
        if (chk[x * y / 2] && cur > chk[x * y / 2] + dis - 1) {
          cur = chk[x * y / 2] + dis - 1;
          x1 = ans[x * y / 2].first, y1 = ans[x * y / 2].second, x2 = x,
          y2 = y / 2;
        }
      }
    }
    if (y % 3 == 0) {
      if (vis[x * 2 * y / 3] == 0) {
        vis[x * 2 * y / 3] = 1;
        q.push(node(x, y * 2 / 3, dis + 1));
        if (chk[x * 2 * y / 3] && cur > chk[x * 2 * y / 3] + dis - 1) {
          cur = chk[x * 2 * y / 3] + dis - 1;
          x1 = ans[x * 2 * y / 3].first, y1 = ans[x * 2 * y / 3].second, x2 = x,
          y2 = y * 2 / 3;
        }
      }
    }
  }
  if (cur == 2147483647)
    printf("-1");
  else
    printf("%d\n%d %d\n%d %d", cur, x1, y1, x2, y2);
}
int main() {
  cin >> n1 >> m1 >> n2 >> m2;
  pre();
  bfs();
  return 0;
}
