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

#GL0000088. Tổng nhỏ nhất với BCNN cho trước (Minimum Sum LCM)

HỌC THEO LỘ TRÌNH

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

1 lộ trình

Tổng nhỏ nhất với BCNN cho trước (Minimum Sum LCM)

Minimum Sum LCM

Source: UVa

Version: Phuoc Hung OJ Extended

Problem Statement

Given a positive integer NN, choose a sequence of at least two positive integers (repetitions are allowed) whose LCM is exactly NN. Among all such sequences, find the minimum possible sum of the chosen integers. Print only this sum.

Input

One line containing a positive integer NN.

Output

Print the minimum possible sum.

Subtasks

  • Subtask 1 (20 points): 1≤N≤1031\le N\le 10^3
  • Subtask 2 (30 points): 1≤N≤1061\le N\le 10^6
  • Subtask 3 (50 points): 1≤N≤231−11\le N\le 2^{31}-1

Examples

Input

12

Output

7

Explanation

Choose 33 and 44: their LCM is 1212 and their sum is 77. No valid sequence with LCM 1212 has a smaller sum.