solve srm 577 div1