Baltic Olympiad in Informatics: 2003 Day 2, Problem 2
There is a castle with a circular main hall. There are lamps numbered from to on the wall of the hall. Each of the lamps can be either on or off. At each second the lamp number changes its state if the lamp number is on, except the lamp number changes its state if the lamp number is on.
Your task is, given the initial states of all lamps at some moment, to find their states after seconds.
Input Specification
The first line of the input contains two integers and . The next lines contain the initial states of the lamps, starting with the lamp number . A line containing means that the lamp is off and means that the lamp is on.
Output Specification
The output must contain exactly lines describing the states of the lamps after seconds, starting with the lamp number .
Sample Input
3 1
0
0
1
Sample Output
0
1
1
Comments