A 40-foot piece of siding is cut into three pieces so that the second piece is four times as long as the first piece and the third piece is five times as long as the first piece. If x represents the length of the first piece, find the lengths of all three pieces.