An isosceles triangle (two sides equal) is placed on top of a square as shown in the picture. If the two equal sides of the triangle are 17cm long and the square is 27cm on each side, what is the perimeter of the figure?