You are looking at one game between Ann and Bob, and you suspect that Ann is cheating. To confirm or refute your suspicions, please count the number of positions where the ship could be placed according to Ann’s answers.
Input
Every case begins with r, c, m and n. Follow n triples i, j, x, where 1 ≤ i ≤ r is the row of the shot, 1 ≤ j ≤ c is the column of the shot, and x is a character that is ‘h’ or ‘m’ depending on whether the shot is a hit or a miss according to Ann. Assume 1 ≤ r ≤ 108, 1 ≤ c ≤ 108, 2 ≤ m ≤ 100, and 0 ≤ n ≤ 105. The coordinates of all the shots are different.
Output
For every case, print the number of possible locations of the ship hidden by Ann. If this number is 0 or if Ann’s answers are clearly wrong, print “Ann is cheating.”.
Input
1 2 2 0 4 6 3 0 4 6 3 1 2 3 m 4 6 3 1 2 3 h 4 6 3 2 2 3 h 2 4 m 4 6 5 0 3 3 4 0 1 7 4 1 1 4 m 1 7 4 2 1 4 h 1 1 h 1 7 4 2 1 5 h 1 1 h 100000000 100000000 2 0
Output
1 28 23 5 3 8 Ann is cheating. Ann is cheating. 1 Ann is cheating. 19999999800000000