You are given a singly linked list containing ‘N’ nodes (‘N’ is even), where every node in the linked list contains a pointer ‘NEXT’, which points to the next node in the list and has an integer value associated with it.
Your task is to break LinkedList into two halves and then take the first half, fold it over the second half and merge all the intersecting nodes by taking their product.
Note :
You will apply this operation only once, check example for better understanding.
Example :
N = 4
NODE = 1 -> 2 -> 3 -> 4

In the following example, first, you break your List into two equal half, [ 1 -> 2 ] and [ 3 -> 4 ],


Now you will fold the first half over the second half and merge them with their product.
So the answer is [ 3 * 2 -> 4 * 1 ] i.e. [ 6 -> 4 ].

Input Format :
The first line contains an integer ‘T’ denoting the number of test cases. Then each test case follows.
The first line of the test case contains ‘N + 1’ space-separated where the first 'N' elements represent the LinkedList node, and the last integer is always '-1' representing the end of the LinkedList.
Output format :
Print the folded and merged LinkedList. Make sure to add ‘-1’ at the end of your resulting LinkedList.
Note :
You don’t need to print anything. It has already been taken care of. Just implement the given function.
Constraints :
1 <= T <= 10
1 <= N <= 1e5
Sum of N <= 10^5
Time Limit: 1 sec