function to calculate the cumulative sum from a [ i ] to a [ j ]
function sum ( a , i , j ) { var ans = 0 ; for ( var m = i ; m <= j ; m ++ ) ans = ( ans + a [ m ] ) % 100 ; return ans ; } function solve ( a , i , j ) {