View as PDF

Submit solution

Points: 3
Time limit: 1.0s
Memory limit: 256M

Problem type

In another universe, there exists a sport called PONG!, involving 2 players. In the PONG Finals today, the match proceeds as follows:

  • If Player 1 is behind Player 2, then Player 1 will experience a burst of determination and win X points in a streak.

  • If Player 2 is behind or equal to Player 1, then Player 2 will seize the opportunity and win Y points in a streak first, followed by Player 1 winning Z points in a streak in retaliation.

Both of these actions are uninterruptible, since the players simply cannot control their emotions in the heat of the intense match.

Who will have a score of L points first and emerge victorious?


1\leq X, Y, Z\leq 400

1\leq L\leq 10000

Input Specification

The first line of input contain 3 integers, X, Y, and Z.

The second line of input will be the integer, L.

Output Specification

Output a single line containing the number of the player who will win.

Sample Input

5 2 1

Sample Output


Explanation for Sample

First, Player 2 wins 2 points, and then Player 1 wins 1 points in retaliation. Then Player 1 wins 5 points in a row and wins the match.


  • 0
    teddycitrus  commented on Feb. 21, 2024, 3:59 a.m.

    i keep getting case 15 WA but i genuinely dont see whats wrong with my logic someone help