Find the minimal possible perimeter of a convex $n$-gon with vertices at points with integer coordinates. The polygon must have interior angles less than $180$ degrees.
It is guaranteed that $n$ is even. For $n = 4$ the output should be $4$.
It is optimal do a square with side length $1$ in this test.
For $n = 10$ the output should be $14.12899$.
This is an example of a convex $10$-sided polygon with minimal perimeter (with vertices at integer coordinates). It has four sides of length $1$, four sides of length $\sqrt{2}$, and two sides of length $\sqrt{5}$, for a total of about $14.12899$. What is the formula?