mapReduce mean function