Practice on Toph

Participate in exhilarating programming contests, solve unique algorithm and data structure challenges and be a part of an awesome community.

For Loop FTW

By flash_7 · Limits 1s, 512 MB

You are given an integer N which can be represnted as the product of two positive integers.

$ N = a_1 * a_2 \; , \text{where } a_1, a_2 > 0$

It is guaranteed that there will be at least 1 such representation of N.

Among all the possible pairs of (a1, a2) choose the one which maximizes (a1 + a2).

You have to print that maximum value of (a1 + a2).

For example, you can represent 12 as following pairs: (1, 12) , (2, 6), (3, 4).

So, the answer for 12 would be 1+12 = 13.

Input

You’ll be given an integer N (1 ≤ N ≤ 100000).

Output

Print a single integer representing the above mentioned answer.

Sample

InputOutput
12
13

    Discussion

    Statistics


    99% Solution Ratio

    prodip_bsmrstuEarliest, Dec '18

    prodip_bsmrstuFastest, 0.0s

    riadroxLightest, 0 B

    mdvirusShortest, 15B

    Submit

    Login to submit

    Editorial

    It is trivial that the answer would be simply $N+1$. You can also factorize $N$ and find the maximu... Read more...

    Related Contests

    Intra NSU Programming Contest Fall 2018 Ended at 2018-11-23 07:20:00 +0000 UTC
    Replay of Intra NSU Programming Contest Fall 2018 Ended at 2018-12-07 17:00:00 +0000 UTC
    Inter University Girls' Programming Contest Season 2 Mock Ended at 2019-07-18 16:00:00 +0000 UTC