Not so Flat After All#1273

Not so Flat After All

1 second
64 megabytes
Easy

Any positive integer can be written as p_1^{a_1} p_2^{a_2} \ldots p_n^{a_n}, where p_i are prime numbers and a_i \ge 0. For example, 24 = 2^3 \times 3^1.

Pick any two distinct prime numbers p_1 and p_2. Imagine a two-dimensional plane where the powers of p_1 are plotted on the -axis and the powers of p_2 are plotted on the -axis. Any number that can be written as p_1^{a_1} p_2^{a_2} can be plotted on this plane at the location (x, y) = (a_1, a_2). The figure on the right shows a few examples where p_1 = 3 and p_2 = 2.

This idea can be extended to any -dimensional space, where each of the axes is assigned a unique prime number. Each -dimensional space has its own unique set of primes. We call such a set the Space Identification Set, or for short. (the cardinality of ) is .

Any number that can be expressed as a product of the primes from (each raised to a non-negative integer power) can be plotted in this -dimensional space. The figure at the bottom illustrates this idea for N = 3 and S = \{2, 3, 7\}. Clearly, any number plotted in space can also be plotted in space if S_A \subseteq S_B.

We define the distance between any two points in a given -dimensional space as the sum of units travelled to go from one point to the other along the grid lines (i.e., movement is always parallel to one of the axes). For example, in the figure below, the distance between and is .

Given two positive integers, write a program that determines the minimum order of a space where both numbers can be plotted, and the distance between these two integers in that space.

Input

Your program will be tested on one or more test cases. Each test case is specified on a line with two positive integers and (0 < A, B < 1\,000\,000) such that A \times B > 1.

The last line consists of two zeros.

Output

For each test case, print a line in the following format:

. \ X:D

Where is the test case number (starting from ), is the minimum order of a space in which both and can be plotted, and is the distance between these two points.

Note: There is a blank space before .

Examples

Example 1

Loading
Loading