find the path in the tree based on the sum value