#include <bits/stdc++.h>
const int Mod = (int)1e9 + 7;
const int MX = 1073741822;
const long long MXLL = 9223372036854775807;
const int Sz = 1110111;
using namespace std;
inline void Read_rap() {
  ios_base ::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
}
long long a1, b1, a2, b2;
int x1, NOT, x2, y2;
inline void conv(long long v, int &x, int &y, long long &c) {
  while (v % 2 == 0) x++, v /= 2;
  while (v % 3 == 0) y++, v /= 3;
  c = v;
}
inline void divide2(int which) {
  if (which == 1) {
    if (a1 % 2 == 0)
      a1 /= 2;
    else
      b1 /= 2;
  } else {
    if (a2 % 2 == 0)
      a2 /= 2;
    else
      b2 /= 2;
  }
}
inline void divide3(int which) {
  if (which == 1) {
    if (a1 % 3 == 0)
      a1 = (a1 / 3) * 2;
    else
      b1 = (b1 / 3) * 2;
  } else {
    if (a2 % 3 == 0)
      a2 = (a2 / 3) * 2;
    else
      b2 = (b2 / 3) * 2;
  }
}
int main() {
  Read_rap();
  cin >> a1 >> b1;
  cin >> a2 >> b2;
  long long c1, c2;
  conv(a1 * b1, x1, NOT, c1);
  conv(a2 * b2, x2, y2, c2);
  if (c1 != c2) {
    cout << -1;
    return 0;
  }
  int ans = 0;
  while (NOT > y2) {
    NOT--, x1++, ans++;
    divide3(1);
  }
  while (y2 > NOT) {
    y2--, x2++, ans++;
    divide3(2);
  }
  while (x1 > x2) {
    x1--, ans++;
    divide2(1);
  }
  while (x2 > x1) {
    x2--, ans++;
    divide2(2);
  }
  cout << ans << endl;
  cout << a1 << ' ' << b1 << endl;
  cout << a2 << ' ' << b2 << endl;
  return 0;
}
