596 div2 500pt problem