public void subRoutine(TreeNode root, int base) {
        if (root == null) {
            return;
        }
        base = base*10 + root.val;
        if (root.left == null && root.right == null) {
            sum += base;
        }
        subRoutine(root.left, base);
        subRoutine(root.right, base);
    }