Under construction

Still being built. Things may change

I AM IRONMAN

Interview

Time limit1sMemory limit256 MB

Summary
Simulate N games: look up each opponent in a win/loss table, add W or subtract L (floored at 0), and report whether the score ever reaches G.
Level

Easy3 of 10

Topics
Simulation, Implementation, Hash map, Array
Solved
No attempts yet

Problem

Everyone who saw the title probably thought of the hottest movie these days, but this story is the sad tale of Hyeongdong, who sits in the Iron tier of the game LUL (League Us Legends). In LUL, a tier is an indicator of how good a player is. The Iron tier sits at the lowest level. Hyeongdong, mocked by his friends Gangyeop and Geonhong, who called him "Ironman" and said he was bad at the game, resolved that he would escape the Iron tier no matter what. But Hyeongdong knows he can never escape the Iron tier with his own skill. Because LUL is a game played by two players on one team, he can win a game even if he plays badly, and he can lose a game even if he plays well. Hyeongdong is bad at the game but very clever, so he hacked the LUL game and learned how the outcome of a game turns out when he plays with certain players. However, when he plays with a player he could not identify through hacking, Hyeongdong is so bad that his team loses no matter how well his teammate plays.

In the case above, playing with "JIHOON" gains 20 points (W = 20), while playing with "GANGYEOP" or "MINSUNG" loses 15 points (L = 15). In addition, when he meets a player he could not identify through hacking, Hyeongdong is so bad that he loses, so he loses 15 points. (The score never drops below 0, no matter how many times he loses.)

If Hyeongdong escapes the Iron tier over N games, he shouts "I AM NOT IRONMAN", but if he does not escape, he shouts "I AM IRONMAN".

Here, if escaping the Iron tier required reaching 100 points (G = 100) or more, then he escaped the Iron tier by playing the 9th game (the orange square), so Hyeongdong shouts "I AM NOT IRONMAN". Once he escapes the Iron tier, he does not care about later games.

But if escaping required reaching 200 points (G = 200) or more, then Hyeongdong did not escape the Iron tier, so he shouts "I AM IRONMAN".

Let us guess which line Hyeongdong will say after the games end.

Input

The first line gives the total number of games N and the number of player records obtained through hacking P. (N and P are positive integers no greater than 1,000.)

The second line gives the points gained on a win W, the points lost on a loss L, and the score needed to leave the IRON tier G. (0 ≤ W, L ≤ 100, 1 ≤ G ≤ 100,000; W, L, and G are integers.)

The next P lines each give a player's name paired with the word W if Hyeongdong always wins with that player, or the word L if he always loses.

The next N lines each give the name of the player he plays the game with.

Player names always appear in uppercase and are no longer than 20 characters.

Output

Starting from 0 points, output "I AM IRONMAN!!" if Hyeongdong does not escape the Iron tier, and "I AM NOT IRONMAN!!" if he does.

Examples2

  1. Example 1

    Input
    10 3
    20 15 100
    JIHOON W
    GANGYEOP L
    MINSUNG L
    JIHOON
    MYEONGKI
    GANGYEOP
    MINSUNG
    JIHOON
    JIHOON
    JIHOON
    JIHOON
    JIHOON
    MINSUNG
    
    Expected output
    I AM NOT IRONMAN!!
    
  2. Example 2

    Input
    10 3
    20 15 100
    JIHOON W
    GANGYEOP L
    MINSUNG L
    JIHOON
    GANGYEOP
    JISUP
    MINSUNG
    JIHOON
    JIHOON
    MOJI
    KYUNGMIN
    SOOHO
    SEOKGYE
    
    Expected output
    I AM IRONMAN!!