logo AlgoBeat OnlineJudge
登录 注册

#209509. [EC Final 2020] Square

内存限制:256 MiB 时间限制:1000 ms 标准输入输出
题目类型:VJudge(洛谷) 评测方式:VJudge
上传者: 匿名

题目描述

Father Study loves math very much.

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.

输出格式

Output one integer -- the answer modulo .

样例

样例输入 1

3
2 3 6

样例输出 1

6