In the figure below, R = 2 cm, Q = 2 cm, and P = 4 cm. The figure consists of a small rectangle, a large rectangle, and one-fourth of a circle.

What is the total perimeter of the figure?