Function to find the sum of all the elements which are less than or equal to index
int sum_bitree ( int BITree [ ] , int index ) { int s = 0 ; while ( index > 0 ) { s += BITree [ index ] ; index -= ( index & ( - index ) ) ; } return s ; }