can u plz explan how u r getting 19 in the second case… here is the link http://www.codechef.com/problems/OMAX/