Roger is addicted to the game Fire Emblem Heroes! His main hero is Hector, who has health and deals damage per turn. Hector is up against a foe who deals damage per turn, and has health. However, Hector's special, Buckler, activates every 4th turn and negates all damage done against him in that turn, as well as continues to deal the regular amount of damage.
Given of these enemies, can you find out who will come out victorious if Hector attacks first, and how many turns it will take?
Note: assume the turn counter, as well as Hector's health, reset with each foe.
Constraints
Subtask 1 [60%]
Subtask 2 [40%]
Input Specification
Line : Three space separated integers, , , and .
Lines : Two space separated integer, the and for each foe.
Output Specification
lines, of the format Win x
if Hector wins in turns, or Lose x
if Hector loses in turns.
Sample Input
4 12 5
4 2
999 999
5 12
20 3
Sample Output
Win 1
Lose 1
Win 1
Win 4
Comments
https://www.youtube.com/watch?v=02kKKQ3JWPY
Test cases are too weak. Most participants passed with brute force, while the time complexity for brute force is around . This has a worst case of , which is far too inefficient.
Edit:
Test case that cracks most submissions: