Add mapReduce (more general function, generalizing both sum and product)