K-lcm (hard Version)

medium
https://codeforces.com/contest/1497/problem/C2

Input Format

Check the link

Output Format

Check the link

Constraints

Check the link

Notice

Check the link

Example

Input
check the link
Output
check the link
Previous
K-lcm (easy Version)
Next
Polo The Penguin And Xor Operation

Related Questions