#### D. Bear and Company

For a pair of vertices$(s,t)$ we define $f(s,t)$ as the minimum number of jumps Limak needs to get from s to t. Your task is to find the sum of $f(s,t)$ over all pairs of vertices $(s,t)$ such that $s < t$.

See my code for details.好好理解.