|
<p> Let <b>d(N)</b> be the number of positive divisors of positive integer <b>N</b>. |
|
Consider the infinite sequence <b>x(n) = d(n)<sup>a</sup> / n<sup>b</sup>, n = 1, 2, 3, …</b> |
|
where <b>a</b> and <b>b</b> are fixed positive integers. |
|
It can be shown that this sequence tends to zero. Hence it attains its maximum. Denote it by <b>p/q</b> where <b>p</b> and <b>q</b> are co-prime positive integers. Your task is for given <b>a</b> and <b>b</b> find <b>p</b> and <b>q</b> modulo <b>M = 10<sup>9</sup>+7</b>. But to keep input and output small you will be given tuples <b>(b1; b2; a1; a2; c)</b> and need to calculate the sum of <b>(p mod M)</b> for all pairs <b>(a; b)</b> such that <b>b1 ≤ b ≤ b2</b>, <b>a1 ≤ a ≤ a2</b> and <b> a ≤ c*b</b>, and the same sum for <b>q</b>-values. </p> |
|
|
|
<h3>Input</h3> |
|
<p>The first line contains a positive integer <b>T</b>, the number of test cases. <b>T</b> test cases follow. The only line of each test case contains five space separated positive integers <b>b1, b2, a1, a2</b> and <b>c</b>.</p> |
|
|
|
<h3>Output</h3> |
|
<p>For each of the test cases numbered in order from <b>1</b> to <b>T</b>, output "Case #i: " followed by a space separated pair of integers: the sum of <b>(p mod M)</b> for all pairs <b>(a; b)</b> mentioned above and the sum of <b>(q mod M)</b> for all such pairs. Note that you need to find the sum of residues not the residue of sum (see testcase 3 as a reference).</p> |
|
|
|
<h3>Constraints</h3> |
|
<p> |
|
1 ≤ <b>T</b> ≤ 20<br/> |
|
1 ≤ <b>b1</b> ≤ <b>b2</b> ≤ 10,000<br/> |
|
1 ≤ <b>a1</b> ≤ <b>a2</b> ≤ 250,000<br/> |
|
1 ≤ <b>c</b> ≤ 25<br/> |
|
in each testcase the total number of pairs <b>(a; b)</b> for which the answer should be calculated does not exceed 100,000<br/></p> |
|
|
|
|