The sum of the distances between the midpoints of opposite sides of a quadrilateral equals its semiperimeter. Prove that this quadrilateral is a parallelogram.