recursively accumate for each brahch
sol of q129