The Service Club is famous in Sōbu High School for their ability to find the optimal solution to problems, albeit not always the prettiest. One day, Isshiki Iroha, the student council president, goes to the Service Club to ask for help with student council work again. To Hikigaya Hachiman and Yukinoshita Yukino's dismay, Yuigahama Yui, being the nice girl that she is, offers to help her.
Your job is to help the Service Club solve the student council's job, as Hikigaya is too lazy to do it himself and Yukinoshita Yukino is currently busy for some reason.
The student council is to create a rectangular flower garden given ~A~ units of soil then fence it off using the least amount of fencing to save as much of the student council budget as possible. What is the minimum amount of fencing required to fence off all the soil given that the side lengths of the garden must be integers?
Oh yeah? Good on you to notice. You're right, I am nice. I've been through all kinds of things in my life, but I haven't gone out for revenge on a single person at all. If I was any other normal person, this world would've ended already. You could even call me the savior of the world.
The input will consist of ~1~ integer ~A~ ~(1 \le A \le 1\,000\,000)~, the amount of soil the student council is given.
Output ~P~, the minimum amount of fencing required to fence off the garden.
Sample Input 1
Sample Output 1
~4 \times 4~ has smallest perimeter ~P = 4 + 4 + 4 + 4 = 16~
Sample Input 2
Sample Output 2
~9 \times 10~ has smallest perimeter ~P = 9 + 10 + 9 + 10 = 38~