public ListNode addTwoNumbers(ListNode l1, ListNode l2) {
        int overflow = 0;
        ListNode cur = new ListNode(0);
        ListNode head = cur;
        while (l1 != null || l2 != null || overflow != 0) {

            int sum = overflow;
            if (l1 != null) {
                sum += l1.val;
                l1 = l1.next;
            }
            if (l2 != null) {
                sum += l2.val;
                l2 = l2.next;
            }

            if (sum >= 10) {
                sum %= 10;
                overflow = 1;
            } else {
                overflow = 0;
            }
            ListNode node = new ListNode(sum);

            cur.next = node;
            cur = node;
        }


        return head.next;
    }