Program for finding distance