Could anybody tell me why the expected output of input 20 is 49?

First I choose 17, which splits range [1, 20] to [1, 16] and [18, 20].

The cost of solving [1, 16] is 34, and the cost of solving [18, 20] is 19, so we get 17 + 34 = 51 in total?

Could anybody show the detailed procedure of solving input 20 step by step?

Thank you very much! :)