implement mid solution in dynamic programming
solve TCO2014R3A mid