Four right triangles with distinct integer hypotenuses are put together to form a quadrilateral, as shown in image.
What's the smallest possible perimeter of this quadrilateral?

Note: Legs of the triangles need not to be integers.

The nine Horses are square fenced as shown in the picture below. By constructing just two square fences can you make sure that two Horses cannot meet each other without crossing the fence?