@skirpichev 
> This is wrong.

Is that? I tried with test cases but it gave same outputs what master gives. I have proven the code too in some of the above comments. Are you not sure though?