Seema loves playing with linked lists and numbers. She has two linked lists namely, A and B. The nodes of both the linked list have a value associated with them. If there is a value in a node of B that is also present at some position in A then she wants to choose all the occurrences of that element from A. Return the product of all the chosen elements modulo 10007.