recursively sum an array