Given a sequence of integers , Father Study wants to calculate another sequence of integers satisifing
For each , .
For each , is a square number. (In mathematics, a square number or perfect square is an integer that is the square of an integer, in other words, it is the product of some integer with itself.)
is minimized.
Please help Father Study to calculate the answer --- the minimum value of . Because the answer is too large, please output the answer modulo .
输入格式
The first line contains a single integer ().
The second line contains integers () separated by single spaces.