eolymp
bolt
Try our new interface for solving problems
Problems

Strange Joseph and The Knights of Round Table

Strange Joseph and The Knights of Round Table

\includegraphics{https://static.e-olymp.com/content/2d/2d582cb9b11711d553749f68f113774e9e97e5ec.jpg} \textbf{N} people are sitting at the round table. Each participant gets a number which begins from \textbf{1}. Two neighbors have the serial numbers except first and last one. Joseph is calling two positive integers \textbf{X} and \textbf{Y} (\textbf{X} < \textbf{Y}). The circle is dividing into two circles. All the participants with the number from \textbf{X+1} till \textbf{Y-1} are sitting at new round table. The participant with numbers from \textbf{Y+1} till \textbf{N} and from \textbf{1} till \textbf{X-1} are sitting in another round table. The participants with the numbers \textbf{X+1 }and \textbf{Y+1} are getting new number \textbf{1}. According to that all the participants in the new circle are getting new numbers. If it stays only one participant at the table he becomes a spectator and the table leave the game. If there is \textbf{0 }of participants then the table just leaves the game. Joseph continue to call two positive numbers the same action is happen for all tables. He continue the game until it stays the tables where it is at less two participants. Joseph is asking you to find out how many spectators who was participant at beginning will be in the end, and return their numbers in a start numbering. \InputFile Three positive integers: \textbf{N} -- the initial number of people (\textbf{4} ≤ \textbf{N} ≤ \textbf{10^5}), and \textbf{X}, \textbf{Y} -- numbers, mentioned by Joseph.(\textbf{1} ≤ \textbf{X} < \textbf{Y} ≤ \textbf{10^9}). \OutputFile First line will contain one number -- the number of people who was taking part in a game and became a spectators. In next line initial numbers of spectators. In ascending order. If there isn’t players who transfer to spectator -- print single line with "\textbf{0}" (without brackets).
Time limit 1 second
Memory limit 64 MiB
Input example #1
8 2 4
Output example #1
3
1 3 7
Author Ostap Stoliarchuk
Source Distance Summer Computer School - Summer 2013