#P4101. Zealot Round-game Stones

    ID: 17349 Type: Default 1000ms 256MiB

Zealot Round-game Stones

Zealot Round-game Stones

Little Z is a true ZRP (Zealot Round-game Player) who loves turn‐based games. He recalls a childhood game played in the Jiangnan region. Initially, there are n piles of stones, each containing exactly 1 stone. Two players take turns (Little Z goes first). In each turn a player must choose any two piles and merge them into one pile. However, there is an important restriction: at any moment, the number of stones in any pile may not exceed m. In other words, if two piles have a and b stones respectively, they can only be merged if

\(a+b \le m\).

The game ends when no legal merge is possible; the player who is unable to make a move loses. Both players play optimally. Given the numbers n and m, determine who will win the game.

inputFormat

The input consists of two space‐separated integers n and m (1 ≤ n, m ≤ 109), where n is the number of piles initially (each with one stone) and m is the maximum allowed stones in any pile.

outputFormat

Output a single line containing Z if Little Z (the first player) wins when both play optimally, or Friend if his opponent wins.

sample

1 2
Friend