A right triangle has legs of length 666 and bbb, and a hypotenuse of length ccc. The perimeter of the triangle is 181818. Compute ccc.