A pentagon is formed by placing an isosceles triangle on a rectange. If the pentagon has fixed perimeter P, find the lengths of the sides of the pentagon that maximize the area of the pentagon.