The length of a blue ribbon is 3x metres. The yellow ribbon is 5 metres longer than the blue ribbon. The length of the red ribbon is the square of the length of the yellow ribbon. Calculate the total length of the three ribbons.