- Time limit: 1.00 s
- Memory limit: 512 MB
Consider a game where two players remove sticks from a heap. The players move alternately, and the player who removes the last stick wins the game.
A set determines the allowed moves. For example, if , a player may remove , or sticks.
Your task is find out for each number of sticks if the first player has a winning or losing position.
Input
The first input line has two integers and : the number of sticks and moves.
The next line has integers that describe the allowed moves. All integers are distinct, and one of them is .
Output
Print a string containing characters: W
means a winning position, and L
means a losing position.
Constraints
Example
Input:
10 3 1 3 4
Output:
WLWWWWLWLW