MAIN113 (dynamic programming)