create hw4b.R; move distance weighting factor outside of loop
add hw4b.R