Digit Dynamic Programming (Digit DP) - Preparation to IOI Part 5