Finding expected distance
can any one give the mathematical calculation for the question http://www.codechef.com/CLASH14/problems/CREDDIST