adding distance formula