- 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 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 units of energy. Uolevi uses one unit of energy when moving one unit left or right and 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 , x-coordinate , and his goal is to get to any x-coordinate of floor . Your task is to find out if it is possible to win the game.
Input
The first line of the input contains four integers, , , and . is the number of floors, is the initial x-coordinate of Uolevi, is the initial amount of energy Uolevi has and is the amount of energy jumping up costs. Then follow lines. If floor doesn't have an energy drink, line contains single integer, . If there is an energy drink on floor , line contains three integers, , and . is the x-coordinate of the energy drink, and 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
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