Here is the code:

```
def plusOne(self, head):
"""
:type head: ListNode
:rtype: ListNode
"""
start = None
node = head
while node:
if node.val < 9:
start = node
node = node.next
if start:
start.val += 1
node = start.next
else:
new = ListNode(1)
new.next = head
node = head
head = new
while node:
node.val = 0
node = node.next
return head
```