ENG  RUSTimus Online Judge
Online Judge
Problems
Authors
Online contests
About Online Judge
Frequently asked questions
Site news
Webboard
Links
Problem set
Submit solution
Judge status
Guide
Register
Update your info
Authors ranklist
Current contest
Scheduled contests
Past contests
Rules

2239. Silk Enthusiast

Time limit: 1.0 second
Memory limit: 256 MB
After suffering her 67th defeat from the strongest creature in all of Pharloom — Moss Mother, Hornet decided to change her battle strategy and start using tools in order to kill the boss before she begins attacking.
Hornet has K inventory slots, and she can put at most one tool in each of them. However, since Hornet is a master of the needle, she can also sew any number of tools under her cloak, but this will require sacrificing precious silk. In total, Hornet has N different tools available. To take some of them into the boss fight, she must either put each of them into an inventory or sew it under her cloak. For each tool, the damage it will deal to the boss is known: di, and the amount of silk that must be spent to sew the item under the cloak is si. Each tool in the inventory occupies exactly 1 slot. The same tool cannot be taken twice.
Moss Mother has W health points. Hornet plans to deal exactly W damage with the tools, because if she deals less, Moss Mother will survive and instantly crush Hornet, and if she deals more, a second phase may begin, which Hornet fears even more. Unfortunately, after so many attempts, Hornet is very tired and asked you to help her choose the needed items and decide what to do with them (put them into inventory or sew them under the cloak), so as to spend as little silk as possible and make the total damage of all chosen tools exactly equal to W.

Input

The first line contains 3 integers N (1 ≤ N ≤ 1000) — the number of tools, K (0 ≤ K ≤ N) — the number of inventory slots, and W (1 ≤ W ≤ 5000) — Moss Mothers health points.
Each of the next N lines contains 2 integers: di (1 ≤ di ≤ 5000) — the damage of the i-th tool and si (1 ≤ si ≤ 109) — the amount of silk that must be spent to sew the i-th item. It is guaranteed that all si are distinct.

Output

If it is impossible to deal exactly W damage, print “LOSE” (without quotes).
Otherwise, print “WIN” (without quotes) in the first line. In the next line, print two integers M and S — the number of chosen tools and the total amount of silk spent on sewing them. In the next M lines, describe each chosen tool: print its number in the input and the word “Inventory” (without quotes) if the tool should be put in an inventory slot, or the word “Silk” (without quotes) otherwise. You can print the tools in any order. If there are multiple optimal solutions, you may print any of them.

Samples

inputoutput
2 1 10
5 10
5 100
WIN
2 10
1 Silk
2 Inventory
2 2 6
2 67
3 69
LOSE
Problem Author: Yackov Malin
Problem Source: The 2026 ICPC UrFU Qualification