#Lutece1564. GC?(X,Y)
GC?(X,Y)
Migrated from Lutece 1564 GC?(X,Y)
All parts of this problem, including description, images, samples, data and checker, might be broken. If you find bugs in this problem, please contact the admins.
Description
One positive integer can be represented by the product of some prime numbers.
Sort the prime numbers, such like , .
The (Greatest Common Prefix) of two positive integers is defined as the longest prefix of the multiplication of sorted prime numbers.
For example, $GCP(60,180)=Longest\_Prefix(2\times 2\times 3\times 5,2\times 2\times 3\times 3\times 5)=2\times 2\times 3=12$.
Now, for a given array , calculate .
Input
The first line contains a number .
The second line contains integers .
Output
Output the sum described above.
Samples
5
1 2 8 5 10
13
Note
In the sample,
$GCP(1,2)=GCP(1,8)=GCP(1,5)=GCP(1,10)=GCP(2,5)=GCP(8,5)=GCP(5,10)=1$,
.
Resources
The 15th UESTC Programming Contest Preliminary