Dr. Virginia Apgar developed a test in 1952 to quickly evaluate the general conditions of a new-born.

Virginia Apgar
Dr. Virginia Apgar

This test is executed by obstetricians, gynaecologists or paediatricians one, five and ten minutes after birth to determine the condition of a new-born and is based on the following five criteria:

Each individual critrium is assigned a score of 0, 1 or 2, with the total of all scores constituting the APGAR score. The resulting APGAR score ranges from 0 to 10. The five criteria are summarized using words chosen to form a backronym (Appearance, Pulse, Grimace, Activity, Respiration). The following table summarizes how scores are assigned to each criterium. Most babies are assigned an APGAR score between 7 and 10. In case the total score is less than 4, immediate medical assistance is required.

code criterium 0 points 1 point 2 points
A Appearance/Complexion blue or pale
all over
blue at extremities
body pink (acrocyanosis1)
no cyanosis2
body and extremities pink
P Pulse rate 0/min < 100/min 100/min
G Reflex irritability/Grimace no response grimace/feeble cry
when stimulated
cry or pull away
when stimutated
A Activity none some flexion flexed arms and legs
that resist extension
R Respiratory effect absent weak, irregular, gasping lusty, strong cry

Write a program that calculates the APGAR score from the observations for each of the five criteria. The program must immediately alarm medical assistance in case the total score is lower than 4.

Input

Five lines that contain a description of an observation for each of the five criteria. The observations are listed in the order of the criteria as listed in the introduction (not in the order they appear in the table). Each description is characterized by the keyword indicated in green in the table. As such, descriptions must coincide with these keywords in order to be recognized by the program. The pulse rate is given as an integer.

Output

The APGAR score corresponding to the five given observations. In case the score is less than 4, the text alarm must be printed instead of the score itself. If at least one of the descriptions of the observations does not coincide with one of the possible keywords, nothing but the text invalid input must be printed.

Example

Input:

strong cry
0
resist extension
blue
cry or pull away

Output:

6

Example

Input:

weak
110
none
pale
no response

Output:

alarm

Example

Input:

weak
99
it's ok
pink
grimace

Output:

invalid input