The figure below consists of a rectangle and two semicircles, one on each end, in the x-y coordinate plane.

If $(4,0)$ and $(18,0)$ are coordinates of two points in the figure where the vertices of the rectangle intersect the endpoints of the diameter of the semicircles, what is the perimeter of the figure?