Grundy Number

medium
Two players Alice and Bob are playing a game. They have a pile with n coins in it.
They can pick only allowed numbers of coins at a time given in an array picks.
Alice goes first and they take alternate turns.
The player who picks the last coin is the winner. Can you find out the winner.

Input Format

The first line contains integer n(no. of coins in the pile). Second line contains size of picks array say l picks[0] picks[1] .... picks[l-1]

Output Format

Print the winner (ALICE or BOB).

Constraints

1<= n <= 1000

Example

Input
8
3
5
1
4
Output
BOB
Previous
Palindrome Game (hard Version)
Next
Deleting Divisors

Related Questions