Mins = 2 ^ ( n - 1 - i ) - 1
let mins = ( power ( 2 , n - 1 - i ) - 1 + mod ) % mod ; mins = ( mins * arr [ i ] ) % mod ; let V = ( maxs - mins + mod ) % mod ; sum = ( sum + V ) % mod ; } return sum ; }