#include <bits/stdc++.h>
using namespace std;
using namespace std::chrono;
long long solve() {
  long long a1, b1, a2, b2, t = 0;
  cin >> a1 >> b1 >> a2 >> b2;
  long long a = 0, b = 0, x;
  x = a1;
  while (x % 3 == 0) x = x / 3, a++;
  x = b1;
  while (x % 3 == 0) x = x / 3, a++;
  x = a2;
  while (x % 3 == 0) x = x / 3, b++;
  x = b2;
  while (x % 3 == 0) x = x / 3, b++;
  while (a > b && a1 % 3 == 0) {
    a1 = (a1 / 3) * 2;
    a--;
    t++;
  }
  while (a > b && b1 % 3 == 0) {
    b1 = (b1 / 3) * 2;
    a--;
    t++;
  }
  while (b > a && a2 % 3 == 0) {
    a2 = (a2 / 3) * 2;
    b--;
    t++;
  }
  while (b > a && b2 % 3 == 0) {
    b2 = (b2 / 3) * 2;
    b--;
    t++;
  }
  a = 0;
  b = 0;
  x = a1;
  while (x % 2 == 0) x = x / 2, a++;
  x = b1;
  while (x % 2 == 0) x = x / 2, a++;
  x = a2;
  while (x % 2 == 0) x = x / 2, b++;
  x = b2;
  while (x % 2 == 0) x = x / 2, b++;
  while (a > b && a1 % 2 == 0) {
    a1 = (a1 / 2);
    a--;
    t++;
  }
  while (a > b && b1 % 2 == 0) {
    b1 = (b1 / 2);
    a--;
    t++;
  }
  while (b > a && a2 % 2 == 0) {
    a2 = (a2 / 2);
    b--;
    t++;
  }
  while (b > a && b2 % 2 == 0) {
    b2 = (b2 / 2);
    b--;
    t++;
  }
  if (a1 * b1 != a2 * b2) return cout << -1, 0;
  ;
  cout << t << "\n" << a1 << " " << b1 << "\n" << a2 << " " << b2;
  return 0;
}
signed main() {
  auto start = high_resolution_clock::now();
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  ;
  long long t = 1;
  while (t--) {
    solve();
    cout << "\n";
  }
  auto stop = high_resolution_clock::now();
  auto duration = duration_cast<microseconds>(stop - start);
  cerr << "Time taken:" << duration.count() / 1000000.0 << "seconds"
       << "\n";
  return 0;
}
