Under construction

Still being built. Things may change

Tire Tug

Interview

Time limit1sMemory limit1024 MB

Summary
Distribute M students across N tires, beating the opponent's count on chosen tires to maximize the score gap and report whether a win, draw, or loss is the best outcome.
Level

Medium6 of 10

Topics
Dynamic programming, Greedy, Sorting, Prefix sum
Solved
No attempts yet

Problem

Tire tug is a popular event at the Gyeonggi Buk Science High School sports day.

The rules are as follows.

  1. There are NN tires, and the ii-th tire has a score of SiS_i.
  2. For each tire, both teams assign a number of people to pull that tire.
  3. For each tire, the team that assigns more people gains SiS_i points. If the two teams assign the same number of people, neither team gains points for that tire.
  4. The team with the higher total score wins.

As the brain of Class 1-1, you have learned through a spy how many people Class 1-2, the opposing team, assigned to each tire.

Given the number of tires NN, the number of students in Class 1-1 MM, the score of each tire, and the number of people Class 1-2 assigned, determine whether Class 1-1 can win.

Input

The first line gives the number of tires NN and the number of students in Class 1-1 MM.

The next NN lines give the score SiS_i of the ii-th tire and the number of students PiP_i that Class 1-2 assigned to that tire.

All given numbers are positive integers.

Output

Print W if Class 1-1 can win, D if a draw is the best possible result, and L if Class 1-1 loses no matter what.

Constraints

  • 1≤N≤1001 \le N \le 100
  • 1≤M≤100 0001 \le M \le 100\,000
  • 1≤Si,Pi≤100 0001 \le S_i, P_i \le 100\,000

Examples2

  1. Example 1

    Input
    2 3
    10 2
    5 2
    
    Expected output
    W
    
  2. Example 2

    Input
    3 4
    10 4
    6 1
    7 2
    
    Expected output
    L