These days most countries assign each of the citizens a unique identifier, which we shall call personal code.
In Lithuania, personal code consists of eleven digits, and is assigned according to these rules:
- First digit denotes gender altogether with century of birth. Even numbers are assigned to females, odd to males. Centuries are numbered ascending. For example, “1” is for males born in 19th century whereas “4” is used for females born in 20th century.
- Second and third digits denote birth year in previously determined century.
- Fourth and fifth digits denote month of birth.
- Sixth and seventh digits denote day of birth.
- Eighth, ninth and tenth digits are assigned consecutively.
- Eleventh digit is for checksum. The sum is first calculated:
If this sum, when divided by 11, does not produce 10 as remainder, we have found the checksum. Otherwise, sum is recalculated:
Again, if remainder is not 10, then we have found checksum. Else, we take 0 as the checksum.
Your task is to validate a personal code. Provided on the input file is eleven-digit code. You shall print to the output file
OK if a living person could have given code, or
FAIL otherwise. For this task, you can assume that humans live forever. An example is presented below.
||Birth year would be 2100 + 87 = 2187. That is future.
||March has less than 42 days.