429. Problem Stacks

Time limit per test: 0.5 second(s)
Memory limit: 262144 kilobytes
input: standard
output: standard



Fedor and Sergey are playing a game while preparing for the World Finals. They have chosen a lot of problems to solve, and arranged the problem statements into n heaps, with i-th heap containing ai problem statements, and put those heaps along one straight line. They make alternating moves, and each move consists of taking some (maybe all) problems from the first or from the last heap (but not from both) and solving them (and thus dumping the corresponding problem statements). When some player takes all problems from the first heap, the next heap is now considered first; when some player takes all problems from the last heap, the previous heap is now considered last. The player who doesn't have any more problems to solve loses.

Obviously, both Fedor and Sergey will play optimally. Fedor makes the first move. Who is going to win?

Input
The first line of the input file contains an integer n — the number of heaps (1 ≤ n ≤ 5). The second line of the input file contains n integers a1, a2,..., an ( ) — the amounts of problems in each heap.

Output
Output "FEDOR" (without quotes) if Fedor will win, or "SERGEY" (without quotes) otherwise.

Example(s)
sample input
sample output
3
5 5 5
FEDOR

sample input
sample output
4
3 1 2 3
SERGEY