Problem: Polycarpus likes giving presents to Paraskevi. He has bought two chocolate bars, each of them has the shape of a segmented rectangle. The first bar is a1 × b1 segments large and the second one is a2 × b2 segments large.

Polycarpus wants to give Paraskevi one of the bars at the lunch break and eat the other one himself. Besides, he wants to show that Polycarpus's mind and Paraskevi's beauty are equally matched, so the two bars must have the same number of squares.

To make the bars have the same number of squares, Polycarpus eats a little piece of chocolate each minute. Each minute he does the following:

  * he either breaks one bar exactly in half (vertically or horizontally) and eats exactly a half of the bar, 
  * or he chips of exactly one third of a bar (vertically or horizontally) and eats exactly a third of the bar. 



In the first case he is left with a half, of the bar and in the second case he is left with two thirds of the bar.

Both variants aren't always possible, and sometimes Polycarpus cannot chip off a half nor a third. For example, if the bar is 16 × 23, then Polycarpus can chip off a half, but not a third. If the bar is 20 × 18, then Polycarpus can chip off both a half and a third. If the bar is 5 × 7, then Polycarpus cannot chip off a half nor a third.

What is the minimum number of minutes Polycarpus needs to make two bars consist of the same number of squares? Find not only the required minimum number of minutes, but also the possible sizes of the bars after the process.

Input

The first line of the input contains integers a1, b1 (1 ≤ a1, b1 ≤ 109) — the initial sizes of the first chocolate bar. The second line of the input contains integers a2, b2 (1 ≤ a2, b2 ≤ 109) — the initial sizes of the second bar.

You can use the data of type int64 (in Pascal), long long (in С++), long (in Java) to process large integers (exceeding 231 - 1).

Output

In the first line print m — the sought minimum number of minutes. In the second and third line print the possible sizes of the bars after they are leveled in m minutes. Print the sizes using the format identical to the input format. Print the sizes (the numbers in the printed pairs) in any order. The second line must correspond to the first bar and the third line must correspond to the second bar. If there are multiple solutions, print any of them.

If there is no solution, print a single line with integer -1.

Examples

Input

2 6
2 3


Output

1
1 6
2 3


Input

36 5
10 16


Output

3
16 5
5 16


Input

3 5
2 1


Output

-1

Solution (in JAVA):

Solution:
import java.io.*;
import java.util.*;

public class cf279D {
    public static void main(String[] args) throws Exception {
    	// BufferedReader in = new BufferedReader(new FileReader("cf279D.in"));
    	BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
    	
		String str = in.readLine();
		int a1 = Integer.parseInt(str.substring(0, str.indexOf(" ")));
		int b1 = Integer.parseInt(str.substring(str.indexOf(" ") + 1));
		
		str = in.readLine();
		int a2 = Integer.parseInt(str.substring(0, str.indexOf(" ")));
		int b2 = Integer.parseInt(str.substring(str.indexOf(" ") + 1));
		
		TreeMap<Integer, Integer> mapa1 = new TreeMap<Integer, Integer>();
		TreeSet<Integer> set = new TreeSet<Integer>();
		mapa1.put(a1, 0);
		set.add(a1);
		int count = 0;
		while(!set.isEmpty()) {
			count++;
			TreeSet<Integer> set2 = new TreeSet<Integer>();
			for(int i : set) {
				if(i % 2 == 0) {
					set2.add(i / 2);
					if(!mapa1.containsKey(i / 2)) {
						mapa1.put(i / 2, count);
					}
				}
				if(i % 3 == 0) {
					set2.add(i / 3 * 2);
					if(!mapa1.containsKey(i / 3 * 2)) {
						mapa1.put(i / 3 * 2, count);
					}					
				}
			}
			set = set2;
		}
		TreeMap<Integer, Integer> mapa2 = new TreeMap<Integer, Integer>();
		set = new TreeSet<Integer>();
		mapa2.put(a2, 0);
		set.add(a2);
		count = 0;
		while(!set.isEmpty()) {
			count++;
			TreeSet<Integer> set2 = new TreeSet<Integer>();
			for(int i : set) {
				if(i % 2 == 0) {
					set2.add(i / 2);
					if(!mapa2.containsKey(i / 2)) {
						mapa2.put(i / 2, count);
					}
				}
				if(i % 3 == 0) {
					set2.add(i / 3 * 2);
					if(!mapa2.containsKey(i / 3 * 2)) {
						mapa2.put(i / 3 * 2, count);
					}					
				}
			}
			set = set2;
		}
		TreeMap<Integer, Integer> mapb1 = new TreeMap<Integer, Integer>();
		set = new TreeSet<Integer>();
		mapb1.put(b1, 0);
		set.add(b1);
		count = 0;
		while(!set.isEmpty()) {
			count++;
			TreeSet<Integer> set2 = new TreeSet<Integer>();
			for(int i : set) {
				if(i % 2 == 0) {
					set2.add(i / 2);
					if(!mapb1.containsKey(i / 2)) {
						mapb1.put(i / 2, count);
					}
				}
				if(i % 3 == 0) {
					set2.add(i / 3 * 2);
					if(!mapb1.containsKey(i / 3 * 2)) {
						mapb1.put(i / 3 * 2, count);
					}					
				}
			}
			set = set2;
		}
		TreeMap<Integer, Integer> mapb2 = new TreeMap<Integer, Integer>();
		set = new TreeSet<Integer>();
		mapb2.put(b2, 0);
		set.add(b2);
		count = 0;
		while(!set.isEmpty()) {
			count++;
			TreeSet<Integer> set2 = new TreeSet<Integer>();
			for(int i : set) {
				if(i % 2 == 0) {
					set2.add(i / 2);
					if(!mapb2.containsKey(i / 2)) {
						mapb2.put(i / 2, count);
					}
				}
				if(i % 3 == 0) {
					set2.add(i / 3 * 2);
					if(!mapb2.containsKey(i / 3 * 2)) {
						mapb2.put(i / 3 * 2, count);
					}					
				}
			}
			set = set2;
		}
		TreeMap<Long, Info> mapone = new TreeMap<Long, Info>();
		TreeMap<Long, Info> maptwo = new TreeMap<Long, Info>();
		for(int i : mapa1.keySet()) {
			int x = mapa1.get(i);
			for(int j : mapb1.keySet()) {
				long t = (long) i * j;
				if(mapone.containsKey(t) && mapone.get(t).count > x + mapb1.get(j)) {
					mapone.put(t, new Info(i, j, x + mapb1.get(j)));
				} else {
					mapone.put(t, new Info(i, j, x + mapb1.get(j)));
				}
			}
		}
		for(int i : mapa2.keySet()) {
			int x = mapa2.get(i);
			for(int j : mapb2.keySet()) {
				long t = (long) i * j;
				if(maptwo.containsKey(t) && maptwo.get(t).count > x + mapb2.get(j)) {
					maptwo.put(t, new Info(i, j, x + mapb2.get(j)));
				} else {
					maptwo.put(t, new Info(i, j, x + mapb2.get(j)));
				}
			}
		}
		int mincount = Integer.MAX_VALUE;
		int infox1 = -1;
		int infoy1 = -1;
		int infox2 = -1;
		int infoy2 = -1;
		Iterator<Long> i1 = mapone.keySet().iterator();
		Iterator<Long> i2 = maptwo.keySet().iterator();
		Long curr1 = i1.next();
		Long curr2 = i2.next();
		// System.out.println(mapone);
		while(curr1 != null && curr2 != null) {
			if(curr1.equals(curr2) && mincount > mapone.get(curr1).count + maptwo.get(curr2).count) {
				Info temp1 = mapone.get(curr1);
				Info temp2 = maptwo.get(curr2);
				mincount = temp1.count + temp2.count;
				infox1 = temp1.x;
				infox2 = temp2.x;
				infoy1 = temp1.y;
				infoy2 = temp2.y;
			}
			if(curr1 < curr2) {
				if(i1.hasNext()) {
					curr1 = i1.next();
				} else {
					curr1 = null;
				}
			} else {
				if(i2.hasNext()) {
					curr2 = i2.next();
				} else {
					curr2 = null;
				}
			}
		}
		if(mincount < Integer.MAX_VALUE >> 1) {
			System.out.println(mincount);
			System.out.println(infox1 + " " + infoy1);
			System.out.println(infox2 + " " + infoy2);
		} else {
			System.out.println(-1);
		}
	}

	static class Info {
		int count;
		int x;
		int y;

		public Info(int tempx, int tempy, int c) {
			count = c;
			x = tempx;
			y = tempy;
		}
	}
}