You are given two sequences A and B of length K. A sequence X is built from A and B: each Xi is an integer picked uniformly at random from the integers between Ai and Bi, inclusive, and every Xi is picked independently.
Given A and B, write a program that computes the expected value of gcd(X0,X1,…,XK−1).
Input
The first line contains the number of test cases T (1≤T≤50).
The first line of each test case contains K (2≤K≤5). Each of the next K lines contains Ai and Bi, separated by a space. (1≤Ai≤Bi≤200000)
Output
For each test case, print one answer on its own line.
Write the expected value as an irreducible fraction P/Q. Print N (0≤N≤109+6) such that P+Q×N is divisible by 109+7. If no such N exists, print −1.