Recursion and sum of array