Team Selection

No attempts yetTime limit1sMemory limit128 MB

Problem

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 kk and has all the students stand in a circle. Starting the count at the first student, he walks around the circle and removes every kk-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 kk, determine the last four positions that Bernard removes.

Input

The input contains several lines. Each line has two integers nn and kk separated by a single space, where 4n1074 \le n \le 10^7 and 1k1071 \le k \le 10^7. Here nn is the number of students standing in the circle, numbered from 11 to nn in circle order, and kk 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.

Output

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.

Note

Consider a circle of 99 students with k=3k = 3. Bernard removes students in the order 3,6,9,4,8,5,2,7,13, 6, 9, 4, 8, 5, 2, 7, 1. The last four removed are 5,2,7,15, 2, 7, 1, so those four positions form the team.