Sums over arbitrary intervals Exponential and character sums mathematics