tree dp for sum of simple paths