# python
# 解法一
class Solution(object):
def addTwoNumbers(self, l1, l2):
total = 0
next1 = 0
dummy = ListNode()
cur = dummy
while (l1 != None and l2 != None):
total = l1.val +l2.val + next1
cur.next = ListNode(total % 10)
next1 = total // 10
cur = cur.next
l1 = l1.next
l2 = l2.next
while l1 != None:
total = l1.val + next1
cur.next = ListNode(total % 10)
next1 = total // 10
cur = cur.next
l1 = l1.next
while l2 != None:
total = l2.val + next1
cur.next = ListNode(total % 10)
next1 = total // 10
cur = cur.next
l2 = l2.next
if next1 != 0:
cur.next = ListNode(next1)
return dummy.next