':type head: ListNode
:rtype: ListNode'

def plusOne(self, head):

    if (not head):
        return None
    dummy = ListNode(0)
    dummy.next = head
    (left, right) = (dummy, head)
    while right.next:
        if (right.val != 9):
            left = right
        right = right.next
    if (right.val != 9):
        right.val += 1
    else:
        left.val += 1
        right = left.next
        while right:
            right.val = 0
            right = right.next
    return (dummy if dummy.val else dummy.next)
