class Solution {

public:

```
int sumNumbers(TreeNode *root) {
if (!root) return 0;
if (!root->left && !root->right) return root->val;
return (root->left ? root->left->val += root->val * 10, sumNumbers(root->left) : 0) + (root->right ? root->right->val += root->val * 10, sumNumbers(root->right) : 0);
}
```

};