ENG  RUSTimus Online Judge
Online Judge
Online contests
About Online Judge
Frequently asked questions
Site news
Problem set
Submit solution
Judge status
Update your info
Authors ranklist
Current contest
Scheduled contests
Past contests

2103. Corporate Mail

Time limit: 1.0 second
Memory limit: 64 MB
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 room.
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.
  1. 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.
  2. 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 not directly.
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.


5 7
5 7 
3 30
3 30 
6 1000000
6 5 1000000 
Problem Author: Alexey Danilyuk
Problem Source: Ural FU Junior Championship 2016