시간 제한메모리 제한제출정답맞힌 사람정답 비율
1 초 512 MB49424085.106%

문제

Two candidates are running for this year’s presidential election, John Wee and Preston Wo. Taking a break from promoting their campaign, they decide to play a game with an array $A$ of $N$ integers. The candidates will make alternating moves until there is a single element left, starting with John as the current president.

In each turn, John will choose a contiguous subarray (containing between $2$ to $K$ elements, inclusive) from $A$ and replace the subarray with a single element, which is the sum of all the elements in the subarray. In each turn, Preston will choose a contiguous subarray (containing between $2$ to $K$ elements, inclusive) from $A$ and replace the subarray with a single element, which is the bitwise XOR of all the elements in the subarray. The bitwise XOR of an array of integers $X$ is defined as follows, where $\oplus$ denotes the bitwise XOR notation.

$$XOR(X) = \begin{cases} X_1 \oplus X_2 & \text{if }|X| = 2 \\ XOR([X_1, X_2, \dots, X_{|X|-1}]) \oplus X_{|X|} & \text{if }|X| > 2 \end{cases}$$

Since John is the candidate with number 1, John is the winner of the game if the single element left in the array is an odd number. Otherwise, Preston is the winner of the game if the single element left in the array is an even number. You want to predict who will win the game if both candidates play optimally.

입력

Input begins with a line containing two integers: $N$ $K$ ($2 \le K \le N \le 1000$) representing the length of the array and the maximum length of the chosen subarray for each turn, respectively. The next line contains $N$ integers: $A_i$ ($0 \le A_i \le 1000$) representing the given array $A$.

출력

Output in a line a string representing the winner of the game, either John or Preston.

예제 입력 1

4 3
2 0 3 4

예제 출력 1

John

In his first turn, John can choose the last three elements and change it to $0 + 3 + 4 = 7$. The array now becomes $[2, 7]$. In his first turn, Preston does not have any choice other than choosing the whole array as the subarray and change it to $2 \oplus 7 = 5$. Therefore, John wins the game.

예제 입력 2

3 2
1 2 1

예제 출력 2

Preston

In his first turn, John can either modify the array to $[3, 1]$ or $[1, 3]$. Either way, Preston can change the whole array to $[2]$ and wins the game.