DP solution to dice throw problem.