parameters: (self, root)
return_statement: return sumRootToLeafHelper(root, 0)
docstring: :type root: TreeNode
          :rtype: int
docstring_summary: :type root: TreeNode
          :rtype: int
docstring_tokens: : type root : TreeNode : rtype : int
function: def sumRootToLeaf(self, root):
          """
          :type root: TreeNode
          :rtype: int
          """
          M = 10**9 + 7
          def sumRootToLeafHelper(root, val):
              if not root:
                  return 0
              val = (val*2 + root.val) % M
              if not root.left and not root.right:
                  return val
              return (sumRootToLeafHelper(root.left, val) +
                      sumRootToLeafHelper(root.right, val)) % M
          
          return sumRootToLeafHelper(root, 0)
function_tokens: def sumRootToLeaf ( self , root ) : M = 10 ** 9 + 7 def sumRootToLeafHelper ( root , val ) : if not root : return 0 val = ( val * 2 + root . val ) % M if not root . left and not root . right : return val return ( sumRootToLeafHelper ( root . left , val ) + sumRootToLeafHelper ( root . right , val ) ) % M return sumRootToLeafHelper ( root , 0 )