weighted distance
merge