CSES - KILO 2015 2/5 - Platformer
  • Time limit: 1.00 s
  • Memory limit: 128 MB

Uolevi is playing a game where his goal is to get from the lowest floor to the highest floor. The game consists of nn floors, and each of them is infinitely wide. Uolevi can move left or right on the current floor, or jump upward to the next floor at any point of the game. It is not possible to move downward to the previous floor.

At the beginning Uolevi has ww units of energy. Uolevi uses one unit of energy when moving one unit left or right and kk units of energy when jumping up. If Uolevi runs out of energy, he can't move anymore. Some floors provide an energy drink at some coordinate. After drinking an energy drink, Uolevi gains more energy. Uolevi starts on floor 11, x-coordinate qq, and his goal is to get to any x-coordinate of floor nn. Your task is to find out if it is possible to win the game.

Input

The first line of the input contains four integers, nn, qq, ww and kk. nn is the number of floors, qq is the initial x-coordinate of Uolevi, ww is the initial amount of energy Uolevi has and kk is the amount of energy jumping up costs. Then follow nn lines. If floor ii doesn't have an energy drink, line ii contains single integer, 00. If there is an energy drink on floor ii, line ii contains three integers, 11, xix_i and eie_i. xix_i is the x-coordinate of the energy drink, and eie_i is the amount of energy it provides.

Output

Output 10-4 if Uolevi can win the game, and QAQ if Uolevi can't win the game.

Constraints

  • 2n1052 \le n \le 10^5
  • 1q1051 \le q \le 10^5
  • 1w1091 \le w \le 10^9
  • 1k1041 \le k \le 10^4
  • 1xi1051 \le x_i \le 10^5
  • 1ei1091 \le e_i \le 10^9

Examples

Input:

10 3 7 2
1 5 3
0
1 1 4
0
1 5 5
1 3 2
1 3 6
1 6 2
1 1 1
0

Output:

10-4

Input:

3 4 4 3
0
1 3 2
1 2 5

Output:

QAQ