Create distance.r