Under construction

Still being built. Things may change

FA

Time limit1sMemory limit128 MB

Summary
Starting from a huge integer x, repeatedly replace it with (first digit) times (digit count) and report whether the sequence eventually cycles forever.
Level

Medium4 of 10

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

Problem

The function F(x)F(x) returns the first digit of xx multiplied by the number of digits of xx.

For example, if x=932x = 932, the first digit is 99 and the number of digits is 33, so F(932)=9×3=27F(932) = 9 \times 3 = 27.

Apply FF to the given xx, then apply FF to the result, and keep repeating. If the same number keeps coming out from some point on, xx is called an FA number.

Decide whether xx is an FA number.

Input

The first line contains an integer xx (0≤x≤101000 \le x \le 10^{100}).

Output

Print FA if xx is an FA number, and NFA otherwise.

Examples4

  1. Example 1

    Input
    932
    
    Expected output
    FA
    
  2. Example 2

    Input
    0
    
    Expected output
    FA
    
  3. Example 3

    Input
    7
    
    Expected output
    FA
    
  4. Example 4

    Input
    10
    
    Expected output
    FA