Your security guard friend recently got a new job at a new security company. The company requires him to patrol an area of the city encompassing exactly N city blocks, but they let him choose which blocks. That is, your friend must walk the perimeter of a region whose area is exactly N blocks. Your friend is quite lazy and would like your help to find the shortest possible route that meets the requirements. The city is laid out in a square grid pattern, and is large enough that for the sake of the problem it can be considered infinite.

Input

Input will consist of a single integer N (1 ≤ N ≤ 106), the number of city blocks that must be enclosed by the route.

Output

Print the minimum perimeter that can be achieved.

Examples

Input

4


Output

8


Input

11


Output

14


Input

22


Output

20

Note

Here are some possible shapes for the examples:

<image>
import java.io.*;
import java.util.StringTokenizer;

public class LazySecurityGuard5 {

    public static void main(String... args) {
        InputReader reader = new InputReader(System.in);
        PrintWriter out = new PrintWriter(System.out, false);

        out.println(solve(reader.nextInt()));

        out.flush();
        out.close();
    }

    public static int solve(int N) {
        // this approach starting with a 1x1 rectangle (square)
        // and constantly checks if area (number of blocks) of the
        // rectangle is larger than the number of blocks required (N)
        // if not, extend one side of the rectangle 1 block and check
        // if still not, extend the rectangle one block in the other
        // direction to make it a square and repeat till the area
        // is greater than N, the final length and width values of
        // the rectangle can then be used to find the perimeter

        // start with a 1x1 square
        int length = 1;
        int width = 1;

        // while the area (number of blocks) is less
        // than the needed number of blocks
        while ((length * width) < N) {
            length++; // this extends our initial square to a larger rectangle

            // if the rectangle doesn't contain enough blocks,
            // convert our rectangle to a larger square
            if ((length * width) < N) width++;
        }

        // the perimeter
        return 2 * (length + width);
    }

    static class InputReader {
        public BufferedReader reader;
        public StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }

        public String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

        public int nextInt() {
            return Integer.parseInt(next());
        }
    }

}
