#include <bits/stdc++.h>
class Solution {
 public:
  int EatChocolate(long long &a1, long long &b1, long long &a2, long long &b2) {
    long long area1 = a1 * b1, area2 = a2 * b2;
    long long num_of_2_area1 = 0, num_of_3_area1 = 0;
    long long num_of_2_area2 = 0, num_of_3_area2 = 0;
    while (area1 % (long long)2 == 0) {
      area1 /= (long long)2;
      num_of_2_area1++;
    }
    while (area2 % (long long)2 == 0) {
      area2 /= (long long)2;
      num_of_2_area2++;
    }
    while (area1 % (long long)3 == 0) {
      area1 /= (long long)3;
      num_of_3_area1++;
    }
    while (area2 % (long long)3 == 0) {
      area2 /= (long long)3;
      num_of_3_area2++;
    }
    int ans = 0;
    if (area1 != area2) {
      return -1;
    }
    while (num_of_3_area1 != num_of_3_area2) {
      if (num_of_3_area1 > num_of_3_area2) {
        num_of_2_area1++;
        num_of_3_area1--;
        if (a1 % 3 == 0) {
          a1 = a1 / 3 * 2;
        } else {
          b1 = b1 / 3 * 2;
        }
      } else {
        num_of_2_area2++;
        num_of_3_area2--;
        if (a2 % 3 == 0) {
          a2 = a2 / 3 * 2;
        } else {
          b2 = b2 / 3 * 2;
        }
      }
      ans++;
    }
    while (num_of_2_area1 != num_of_2_area2) {
      ans++;
      if (num_of_2_area1 > num_of_2_area2) {
        num_of_2_area1--;
        if (a1 % 2 == 0) {
          a1 /= 2;
        } else {
          b1 /= 2;
        }
      } else {
        num_of_2_area2--;
        if (a2 % 2 == 0) {
          a2 /= 2;
        } else {
          b2 /= 2;
        }
      }
    }
    return ans;
  }
};
int main() {
  long long a1, b1, a2, b2;
  scanf("%I64d%I64d%I64d%I64d", &a1, &b1, &a2, &b2);
  Solution aa;
  int ans = aa.EatChocolate(a1, b1, a2, b2);
  printf("%d\n", ans);
  if (ans != -1) {
    printf("%I64d %I64d\n%I64d %I64d\n", a1, b1, a2, b2);
  }
  return 0;
}
