Measurement of the diffractive structure function F2D(4) at HERA