A $3 \times8$ rectangle is cut into two pieces along the dotted line shown. The two pieces are then rearranged to form a right-angled triangle. What is the perimeter of the triangle formed?