SUMUP2 - Integer Factorization With A Twist

no tags 

Given a positive integer (K > 2), with prime factorization:

    K = p1^a1 * p2^a2 ... * pn^an   (Excluding 1)

Compute the following:

    S = a1*p1 + a2*p2 ... + an*pn.

Input

A integer K on each line (2 <= k <= 10^15).

Take input until EOF has occurred.

Output

For each integer compute the S = a1*p1 + a2*p2 ... + an*pn and output it on a single line.

Example

Input:
6
7
1804289385
846930888
1681692779
1714636917

Output:
5
7
120285967
18767
360709
1008039

WARNING: There are more than 10000 integers in the test file, use I/O optimization too.


hide comments
(Tjandra Satria Gunawan)(曾毅昆): 2012-07-06 19:46:33

ok, I give up... this problem is too hard for me (time limit too strict)... :(
I can only factor ~100 15-digit-number per second on my computer....

Last edit: 2013-06-29 17:41:55

Francky: 2012-07-06 19:46:33

There's yet many good factorization problems. What's the interest in this one ??? !!!

Last edit: 2012-06-29 17:46:44

Added by:Better late than never !!!
Date:2012-06-29
Time limit:1s
Source limit:50000B
Memory limit:1536MB
Cluster: Cube (Intel G860)
Languages:C C++ 4.3.2 CPP C99
Resource:RamjiLal Sir