It is the night before the IOI team selection results are announced. Every student is awake, confident, and eager to hear the outcome. But when Bernard looks through the exam scores, he starts to worry: every student earned a perfect score, so there is no way to decide who makes the team from the exam alone.
Bernard closes his laptop and announces that this year the team will be chosen differently. He picks a number k and has all the students stand in a circle. Starting the count at the first student, he walks around the circle and removes every k-th student, continuing until the circle is empty. The last four students to be removed form the team.
If you want to make the team, you must plan ahead and stand in one of the four positions that will be selected. Given the number of students in the circle and the value k, determine the last four positions that Bernard removes.
The input contains several lines. Each line has two integers n and k separated by a single space, where 4≤n≤107 and 1≤k≤107. Here n is the number of students standing in the circle, numbered from 1 to n in circle order, and k is the counting interval Bernard uses to remove students.
The last line is 0 0, which marks the end of the input and must not be processed.
For each input line (except the terminating 0 0), print a single line with four integers separated by single spaces: the last four positions removed from the circle, listed in the order Bernard removes them.
Consider a circle of 9 students with k=3. Bernard removes students in the order 3,6,9,4,8,5,2,7,1. The last four removed are 5,2,7,1, so those four positions form the team.