calculate the cost of a journey