Mr Chanek the Ninja day task mission handle mad snake attack site now Mr Chanek arrive hill destination right hill the mission area divide grid size 1000 time 1000 square there n mad snake site ith mad snake locate square x_i Y_i danger level b_imr Chanek going use Shadow Clone Jutsu Rasengan learn Lord Seventh complete mission his attack strategy follow Mr Chanek go M clone each clone choose mad snake attack target each clone pick different mad snake attack all clone jump hills attack respective choose target Rasengan radius r if mad snake square X Y attack direct Rasengan mad snake square X Y maxX X Y Y le R die the real Mr Chanek calculate score attack the score define square sum danger level kill snake now Mr Chanek curious sum score possible attack strategy because number huge Mr Chanek need output modulo 109 7