Calculating costs for route