get max distance