The musical band Be Geeks! got its name by no accident, as all the members are genuine math geeks. Among others, they love examining various properties of number sequences. Let’s see an example of their subject of interest.
Let be a nonempty sequence of positive integers, .
Let , where .
Let , where .
Let , where .
Let over all pairs of integers .
The function gcd stands for the greatest common divisor of the given values. The greatest common divisor of a nonempty sequence of integers is the biggest integer which divides each integer in the sequence evenly.
The first line contains one integer .
The next line contains integers .
Print the value of modulo