Function to add the numbers form by the digits on each path of the tree