Problem list
Log in
#icpc00311 · ICPC BAPC 2018

Cardboard Container

Bronze I 1.0 s 2048 MB

-3mm

-15mm

Fidget spinners are so 2017; this years' rage are fidget cubes. A fidget cube is a cube with unit side lengths, which you hold in your hand and fidget with. Kids these days, right?

You work in the planning department for a company that creates and ships fidget cubes. Having done some market analysis, you found that your customers want to receive shipments of exactly $V$ fidget cubes.

This means you have to design a container that will hold exactly $V$ fidget cubes. Since fidget cubes are very fragile, you cannot have any empty space in your container. If there is empty space, they might move around, bump into each other and get damaged. Because of this, you decide to ship the fidget cubes in a rectangular cardboard box.

The cost of a cardboard box is proportional to its surface area, costing exactly one unit of money per square unit of surface area. Of course you want to spend as little money as possible. Subject to the above constraints, how much money do you have to spend on a box for $V$ fidget cubes?

Input

The input contains a single integer, $1 \leq V \leq 10^6$, the number of fidget cubes for which you need to build a box.

Output

Print the cost of the cheapest rectangular box as specified in the statement.

Example 1

Input
1
Output
6

Example 2

Input
4
Output
16

Example 3

Input
3
Output
14

Example 4

Input
5913
Output
2790
Source
ICPC BAPC 2018
Appears in
Not part of a ladder, contest or set yet.
Accepted 0 Submissions 0 Acceptance 0% Solvers 0

Discussion

Threads about this problem. Spoilers are collapsed; wrap hints in ||double bars||.

No discussion yet. Start a thread if something here needs explaining.

Recent submissions Open with filters
Code