distance and midpoint formula