Dynamic Programming EP116, EP117