There are a lot of people working in Koλ tech company. No,
infinitely many people. But their number is countable,
so they can be numbered by positive integers. Actually, Koλ tech experts
have already taken care of it. Moreover, Koλ tech office is an infinite
one-way sequence of rooms. The i-th employee is working in the i-th
Koλ tech employees are numbered so cleverly that the subordinates of the
employee x are those and only those employees, whose number is divisible
by x and strictly greater than x.
During the working process employees send memos. There are two ways to
transmit memos in Koλ tech.
- It is possible simply to walk to the recipient and give him a memo.
It takes a time which is equal to the distance between employees’ rooms,
which is calculated as the absolute difference of their numbers.
- There is a system of air-mail in Koλ tech. Through this system each
employee can send a memo to any of his subordinates. The time of
transmission by air-mail can be ignored.
Notice, that to speed up the process sometimes it is better to send memos
Historically, employees with lower numbers are considered more influential
(though all employees have a countable number of subordinates).
The size of the board of directors in Koλ tech is equal to a magic number
7, and there are the employees with numbers from 1 to 7 in it. At
the regular meeting of the board of directors, it was noted that a memo
from the members of the board of directors moves too slowly. According to
this, the company suffers serious losses, so it is an urgent need to fix
it. A memo from a member of the board of directors to any employee
should be delivered in the shortest possible time.
This work is entrusted to the employee number 2718281828459045 that is
you. Do it!
Sometimes members of the board of directors send memos to themselves, just
not to forget an important information.
The only line contains integers s and t that are the numbers of memo’s
sender and recipient, respectively (1 ≤ s ≤ 7; 1 ≤ t ≤ 109).
In the first line output the time it takes to transmit the memo. In the
second line output an integer k that is the number of employees who will
participate in the transmission (including the sender and the recipient).
In the third line output k integers that are the numbers of employees in
the order they will receive a memo. If in the process of transmission the
employee will receive a memo several times, it is necessary to output his
number each time.
Note, that k should not exceed 104 and numbers of employees should
not exceed 1014. It is guaranteed that there is an optimal route that
satisfies all constraints. If there are several optimal routes you may
output any of them.
An employee can send a memo only to another employee. The route of memo
can consist of one employee.
6 5 1000000
Problem Author: Alexey Danilyuk
Problem Source: Ural FU Junior Championship 2016