We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.

- All Contests
- ProjectEuler+
- Project Euler #222: Sphere Packing

# Project Euler #222: Sphere Packing

# Project Euler #222: Sphere Packing

What is the length of the shortest pipe, of internal radius , that can fully contain balls of radii where ?

Give your answer in micrometres ( ) rounded to the nearest integer.

**Input Format**

The first line of each test file contains two-separated integers and .

The next line contains space-separated integers .

**Constraints**

- .
- .
- .
- are pairwise distinct.

**Output Format**

Print your answer in one line.

**Sample Input 0**

```
2 1
2
```

**Sample Output 0**

```
4000
```

**Sample Input 1**

```
5 2
3 4
```

**Sample Output 1**

```
13325
```

**Sample Input 2**

```
100 5
61 62 63 64 65
```

**Sample Output 2**

```
530707
```