SOLVE

LATER

Aklank

Problem

Editorial

Analytics

**Aklank** has a habit of challenging his friends in different games. But every time he fails to defeat them and gets frustrated. So, this time he devised one game and named it "**Bakkund**".
**Bakkund** is played between two players. Initially there will be **N** integers. In each turn one player can select any of the n integer and divide it either by **a** or **b** either once or more than one times. He can choose to continue until it is divisible by either **a** or **b**.

Suppose an integer is 6 and a = 2 and b=3: Possible moves are :

1) 6/2 = 3

2) 6/3 =2

3) 6/2 = 3, 3/3 =1

4) 6/3 = 2, 2/2 =1

If in a particular turn a player is not able to take any move than he loses.

Assume that each time Aklank will start first and both will play optimally. Predict whether Aklank can win the game.

**Input**

First line will contain three space separated integers **N**, **a** and **b**.

Next line contains **N** space separated integers **Ai**.

Output

Print "**Aklank's day**" if Aklank wins else print "**Bad Luck**".

**Constraint**

2 ≤ N, a, b ≤ 100000

1 ≤ Ai ≤ 100000

Setter : Sourav Kumar Paul

Explanation

2, 4, 6

Optimal moves are :

1) Aklank : 2/2 -> 1

Status of numbers are : 1, 4, 6

2) Friend : 4/2 -> 2

Status : 1, 2, 6

3) Aklank : 6/3 -> 2

Status : 1, 2, 2

4) Friend : 2/2 -> 1

Status : 1, 1, 2

5) Aklank : 2/2 -> 1

No move left for his friend. So, Aklank wins.

Time Limit:
5.0 sec(s)
for each input file.

Memory Limit:
256 MB

Source Limit:
1024 KB

Marking Scheme:
Marks are awarded when all the testcases pass.

Allowed Languages:
C,
C++,
Clojure,
C#,
D,
Erlang,
F#,
Go,
Groovy,
Haskell,
Java,
Java 8,
JavaScript(Rhino),
JavaScript(Node.js),
Lisp,
Lisp (SBCL),
Lua,
Objective-C,
OCaml,
Octave,
Pascal,
Perl,
PHP,
Python,
Python 3,
R(RScript),
Racket,
Ruby,
Rust,
Scala 2.11.8,
Swift,
Visual Basic

Initializing Code Editor...

{"3a31bdc": "/pagelets/problems-hint/algorithm/aklanks-new-interest/", "3a31b86": "/pagelets/show-submission/algorithm/aklanks-new-interest/", "3a31bf1": "/pagelets/recommended-problems/algorithm/aklanks-new-interest/", "3a31bc7": "/pagelets/problem-author-tester/algorithm/aklanks-new-interest/", "3a31bae": "/pagelets/suggested-problems/algorithm/aklanks-new-interest/"}

{}

realtime.hackerearth.com

80

a873391001b9da4789ce0883046c139715b43c72

58a29e5cae2309f04b28

/realtime/pusher/auth/