Function to precompute prefix sum of numerical Strings
function precomputePrefix ( str , n ) { pref [ 0 ] = str [ 0 ] - " " ; for ( var i = 1 ; i < n ; i ++ ) pref [ i ] = pref [ i - 1 ] + toDigit ( str [ i ] ) ; }