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++,
C++14,
Clojure,
C#,
D,
Erlang,
F#,
Go,
Groovy,
Haskell,
Java,
Java 8,
JavaScript(Rhino),
JavaScript(Node.js),
Julia,
Kotlin,
Lisp,
Lisp (SBCL),
Lua,
Objective-C,
OCaml,
Octave,
Pascal,
Perl,
PHP,
Python,
Python 3,
R(RScript),
Racket,
Ruby,
Rust,
Scala,
Swift,
Visual Basic

Initializing Code Editor...

{"c4e4332": "/pagelets/problem-author-tester/algorithm/aklanks-new-interest/", "ae686e4": "/pagelets/show-submission/algorithm/aklanks-new-interest/", "92d3a44": "/pagelets/suggested-problems/algorithm/aklanks-new-interest/", "72b0ba7": "/pagelets/recommended-problems/algorithm/aklanks-new-interest/", "6d3c80a": "/pagelets/problems-hint/algorithm/aklanks-new-interest/"}

realtime.hackerearth.com

80

a873391001b9da4789ce0883046c139715b43c72

58a29e5cae2309f04b28

/realtime/pusher/auth/