Sum of numbers using custom template function.