OSPF: how distance parameter is calculated ?