Given elements as nodes of the two linked lists. The task is to multiply these two linked lists, say L_{1} and L_{2}.

**Note:** The output could be large take modulo 10^{9}+7.

**Input:**

The first line of input contains an integer T denoting the number of test cases. Then T test cases follow, the first line of each test case contains an integer **N** denoting the size of the first linked list (L1). In the next line are the space separated values of the first linked list. The third line of each test case contains an integer **M** denoting the size of the second linked list (L2). In the forth line are space separated values of the second linked list.

**Output:**

For each test case output will be an integer denoting the product of the two linked list.

**User Task**:

The task is to complete the function **multiplyTwoLists**() which should multiply the given two linked lists and return the result.

**Constraints:**

1 <= T <= 100

1 <= N, M <= 100

**Example:**

**Input:**

2

2

3 2

1

2

3

1 0 0

2

1 0** **

**Output:**

64

1000

**Explanation:
Testcase 1:** 32*2 = 64.

**Testcase 2:** 100*10 = 1000.

Author: Shubham Joshi 1

If you have purchased any course from GeeksforGeeks then please ask your doubt on course discussion forum. You will get quick replies from GFG Moderators there.

akhyasharma01 | 467 |

ASWATHAMA | 399 |

john_wick | 360 |

mmzeineddine | 295 |

PiyushPandey4 | 271 |

PiyushPandey4 | 614 |

ASWATHAMA | 561 |

akhyasharma01 | 547 |

john_wick | 521 |

rahulnishad96 | 442 |

blackshadows | 5362 |

Ibrahim Nash | 5242 |

akhayrutdinov | 5111 |

mb1973 | 4929 |

Quandray | 4598 |

Login to report an issue on this page.