Prime Divisor Spell
Time limit: 2 secMemory limit: 256 MBMath, Dynamic Programming
Problem Statement
In the enchanted land of Algebria, magic and numbers intertwine in mysterious ways. The Grand Magus has discovered that the secret to powerful spells lies in the prime factors of certain enchanted numbers. For this task, you are given an integer . Your mission is to compute the sum of all the unique prime divisors of . Formally, if
where are prime numbers, then you need to find
Should have no prime divisors (i.e. when ), display instead.
Input Format
- The first line of input contains an integer , the number of test cases.
- Each of the next lines contains a single integer .
It is guaranteed that:
Output Format
For each test case, output a single line containing the sum of the unique prime divisors of . If has no prime divisors, print .
Examples
Input
3
1
8
20
Output
-1
2
7
Input
2
15
14
Output
8
9
Code Editor
Submit a solution. Authentication is required to create submissions.