d
k
m
=
1
2
d
i
m
+
d
j
m
-
d
i
j