Solution in Java and C
Code
# Code
```java []
class Solution {
    public ListNode mergeNodes(ListNode head) {
        ListNode dummy = new ListNode(0,head);
        ListNode tail = dummy;
        ListNode current = head.next;
        int sum = 0;

        while(current != null){
            if(current.val == 0){
                ListNode NewNode = new ListNode(sum,null);
                tail.next = NewNode;
                tail = tail.next;
                sum=0;
            }
            else{
                sum += current.val;
            }
            current = current.next;
        }
        return dummy.next;
    }
}
```
```c []
struct ListNode* mergeNodes(struct ListNode* head) {
    struct ListNode dummy;
    struct ListNode* tail = &dummy;
    struct ListNode* current = head->next;
    int sum = 0;

    while (current) {
        if (current->val == 0) {
            struct ListNode* NewNode = malloc(sizeof(struct ListNode));
            NewNode->val = sum;
            NewNode->next = NULL;
            tail->next = NewNode;
            tail = tail->next;
            sum = 0;
        } else {
            sum += current->val;
        }
        current = current->next;
    }
    return dummy.next;
}
```
['Linked List', 'C', 'Java']