Accurate Shots (8Mb TL!)

아직 제출이 없습니다시간 제한5초메모리 제한8 MB

문제

Sophie plans to take over control of the world.  Currently a central computer holds it, but its software has critical bugs.  All that Sophie needs to do to overthrow the computer's rule is to set the value of its variable zz to any integer divisible by mm.

At the moment, the variable zz is set to an integer nn, encoded in binary without leading zeros.  In her basement, Sophie has constructed an ion cannon, whose shot can flip a bit of Sophie's choice in the computer's memory.  Naturally, she is going to target the register holding the variable zz, and in fact can choose to flip any of its bits with an accurate shot.  The cannon can only flip existing bits in the binary representation (which has no leading zeros!), and cannot be used to insert new bits anywhere in the representation, including either of its ends.  However, any leading ones can be flipped to zeros.  Sophie can shoot as many times as she pleases, but each shot increases the chance of her plot being detected.  Thus, she wants to minimize the number of shots.

Help Sophie in seizing power. Write a program that will read the current value nn stored in the variable zz and a number mm from the standard input, determines the minimum number of shots required to overthrow the computer, the number of distinct integers divisible by mm that Sophie can transform nn into with the minimum number of shots, and the smallest such integer and prints those three numbers.

입력

In the first and only line of input there are two positive integers separated by a single space: nn and mm (1n,m10151 \le n, m \le 10^{15}). The former is the initial value of the variable zz, whereas the latter is the one that the final value of zz should be a multiple of.

출력

Three numbers should be printed to the standard output, separated by single spaces: the minimum number of shots to overthrow the computer's rule, the number of distinct nn' that ensure overthrowing the computer with the minimum number of shots fired, and the minimum one out of those nn'.

힌트

In first example, the variable has value 3030, i.e. 11110_(2)11110\_{(2)} in binary.  To make it a multiple of 77, it suffices to shoot once. There are two ways to attain that: by transforming to either 01110_(2)=14\underline{0}1110\_{(2)} = 14 or 11100_(2)=28111\underline{0}0\_{(2)} = 28. The first value is the minimum.

In second example, the variable has value 69=1000101_(2)69 = 1000101\_{(2)}.  The only way to make it a multiple of 4141 is by transforming it to 0=0000000_(2)0 = \underline{0}000\underline{0}0\underline{0}\_{(2)}, which requires three shots.