ENG  RUSTimus Online Judge
Online Judge
Problems
Authors
Online contests
About Online Judge
Frequently asked questions
Site news
Webboard
Links
Problem set
Submit solution
Judge status
Guide
Register
Update your info
Authors ranklist
Current contest
Scheduled contests
Past contests
Rules

1559. TruCoders Linguistics

Time limit: 1.0 second
Memory limit: 64 MB
Several months ago our team thought that it would be quite good if we knew language of TruCoders, creatures that founded the first civilization on the Earth. (How, you haven't heard about them yet?!) But because they were much more intellectual beings than humans, their language (maybe) consisted of very many words and we doubt that we will be able to remember all of them.
It is known that every NSU2 teammate can memorize at most 10100000 words. For example, if TruCoders' language consists of 4000 words, one of them can learn 2000 words and every of two others will learn 1000 words. And so NSU2 will be able to read all of TruCoders' texts.
And now we want you to write a program that can determine whether the team can read all of TruCoders' texts or not.
TruCoders' language is based on English lowercase letters. Overall set of TruCoders' words can be described as a string expression, giving the set of words. All TruCoders' words are strings (possibly empty) of letters. So:
  1. Letter 'a'..'z' means the set consisting of one word consisting of this letter.
  2. Symbol '0' (zero) means an empty set of words.
  3. (<expression>) means the same set of words as <expression>.
  4. <symbol> is either a lowercase letter or '0' or an expression in parentheses — (<expression>).
  5. <expression> is <concatenation> or <concatenation1>|<concatenation2>|…
  6. |<concatenationn> and it means union of sets of words from all <concatenationi>.
  7. <concatenation> is <closure> or <closure1><closure2>…<closuren> and it means set of all words that are concatenations of a word from <closure1>, a word from <closure2> and so on.
  8. <closure> is <symbol> or <symbol>* or <closure>* and it means (if there is '*') <symbol>0|<symbol>1|…|<symbol>n|… (arbitrarily many times) where <symbol>i means <symbol><symbol>…<symbol> (i times) and <symbol>0 means the set consisting of one empty word. And if <closure> is <symbol> it means the same set of words as <symbol> of course.
For example, if language is described as "((a|b)(c|d))", it consists of four words: "ac", "bc", "ad" and "bd".

Input

In the input there is one nonempty string with maximal length of 10000 describing TruCoders' language.

Output

If our team will be able to remember all words of TruCoders' language write 'F'. In the other case write 'N'.

Sample

inputoutput
((a|b)(c|d))
F
Problem Source: Novosibirsk SU Contest. Petrozavodsk training camp, September 2007