URI Online Judge | 2169

Help Leonardo!

By Igor Gomes, UEVA BR Brazil

Timelimit: 1

"Leonardo Silva Kennedy was just a rookie cop when saw the dark event that happened in 1998 in the town of Raccoon City. A long time has passed and Leonardo finally managed to leave behind the images of that day. Six years later, he is an agent the US secret service, responsible for protecting the presidential family.

The President's daughter is kidnapped in the output of your university by an unknown organization. The only clue is that it would have been seen on a remote island in Europe. Now it's up to Leonardo to rescue her. Little did he know that it meant a new immersion in a nightmare that he believed to be over. "

In a certain part of the game, Leonardo discovers a map of a shed where he should go to find a relic. Through the map he can see how many and what kind of monsters are in place. He has N guns and a Y value of ammunition. Luckily for him, there exists near an arms merchant. Leonardo then asks for your help (the merchant) to tell whether he can, with the amount of bullets and the guns he has, kill monsters or be killed.

Follow the weapons that Leonardo has the time and the power of each one:

And the monsters that may be in the shed:

Obs: When choosing a gun, Leonardo uses all bullets that it has.

Input

The input consists of several test cases, each case begins with a value QA (1 <= QA <= 7), indicating the amount of weapons. In the following section is read qa values and their respective amounts of ammunition. It is then read one QM value (1 <= QM <= 10), indicating the amount of monsters, and follow QM lines indicating the monster and the amount of each. And finally, it received a value QB (1 <QB <104), indicating the maximum amount of bullets that he can use, because that way he will not leave without bullets.

Output

For each test case, print if Leon will or will not complete the mission. Show as the sample output.

Input Sample Output Sample

3
MATILDA 14
STRIKER 99
HANDCANNON 67
2
ELGIGANTE 5
GATLINGMAN 9
575
1
STRIKER 77
1
GATLINGMAN 9
375
5
HANDGUN 3
RIFLE 83
BLACKTAIL 20
TMP 14
HANDCANNON 75
8
REGENERATOR 2
COBRAS 2
GARRADOR 9
ELGIGANTE 2
GATLINGMAN 9
ZEALOT 1
DR.SALVADOR 7
COLMILLOS 5
480

Missao completada com sucesso


You Are Dead


You Are Dead