PHƯỚC HƯNG OJ · THỬ THÁCH THUẬT TOÁN

#SP0000035. Biểu diễn thành tích lũy thừa (Number Factorization)

HỌC THEO LỘ TRÌNH

Bài tập thuộc lộ trình

1 lộ trình

Biểu diễn thành tích lũy thừa (Number Factorization)

Number Factorization

Source: Codeforces

Version: Phuoc Hung OJ Extended

Problem Statement

Given an integer nn, consider all pairs of positive-integer arrays a1,…,aka_1,\ldots,a_k and p1,…,pkp_1,\ldots,p_k of equal length such that:

  • n=∏i=1kaipin=\prod_{i=1}^{k}a_i^{p_i};
  • ai>1a_i>1 and pi>0p_i>0 for every ii;
  • each aia_i is a product of one or more distinct prime numbers, with no repeated prime factor.

Find the maximum possible value of S=∑i=1kaipiS=\sum_{i=1}^{k}a_i p_i. The number of terms kk need not be optimized.

Input

One line containing the integer nn.

Output

Print the maximum value of SS as one integer.

Subtasks

  • Subtask 1 (20 points): 2≤n≤1042\le n\le10^4.
  • Subtask 2 (30 points): 2≤n≤1062\le n\le10^6.
  • Subtask 3 (50 points): 2≤n≤1092\le n\le10^9.

Examples

Input

100

Output

20

Explanation

Since 100=22⋅52=102100=2^2\cdot5^2=10^2, choosing a1=10a_1=10, p1=2p_1=2 is valid because 1010 is square-free. It yields 10⋅2=2010\cdot2=20, the maximum. Using a1=100a_1=100 is invalid because 100100 contains squared prime factors.

Input

10

Output

10

Explanation

Since 10=2⋅510=2\cdot5, choosing a1=10a_1=10, p1=1p_1=1 gives S=10S=10. Splitting into factors 22 and 55 gives only 77.