tail recursive sum