Under construction

Still being built. Things may change

Game of Stones

Time limit2sMemory limit512 MB

Summary
Two players alternately remove stones from piles, with Petyr taking up to A per turn and Varys up to B. Determine who wins under optimal play.
Level

Medium6 of 10

Topics
Game theory, Math
Solved
No attempts yet

Problem

Two players, Petyr and Varys, play a game in which they remove stones from N piles in alternating turns. On his turn, Petyr can remove at most A stones from any one pile. On his turn, Varys can remove at most B stones from any one pile. Each player must remove at least one stone on every turn. The player who removes the last stone wins.

The game has already started, and it is Petyr's turn. Determine whether Petyr can win if both players play optimally.

Input

The first line contains three integers N, A, and B (1≤N≤1051 \le N \le 10^5, 1≤A,B≤1051 \le A, B \le 10^5). N is the number of piles, and A and B are the limits for Petyr and Varys. The second line contains N integers X1, ..., XN (1≤Xi≤1061 \le X_i \le 10^6), the current number of stones in each pile.

Output

Print the name of the winner, either Petyr or Varys.

Examples2

  1. Example 1

    Input
    2 3 4
    2 3
    
    Expected output
    Petyr
    
  2. Example 2

    Input
    7 8 9
    1 2 3 4 5 6 7
    
    Expected output
    Varys