Prestack traveltime inversion for three-dimensional structure