H、Eevee
题号:NC17446
时间限制:C/C++/Rust/Pascal 3秒,其他语言6秒
空间限制:C/C++/Rust/Pascal 256 M,其他语言512 M
64bit IO Format: %lld

题目描述

One day, Eevee received an equation from her best friend:
ax x by = cz,
where c and z are given integers.

She wants to count the number of integral solutions (a,x,b,y) of this equation which satisfies 1≤ a,b ≤ m, 0 ≤ x,y ≤ m.

输入描述:

The input starts with one line containing exactly one integer T which is the number of test cases. (1 ≤ T≤ 1000)

Each test case contains one line with three integers c, z and m. (1 ≤ c, m ≤ 105,0 ≤ z ≤ 105)

输出描述:

For each test case, output "Case #x: y" in one line (without quotes), where x is the test case number (starting from 1) and y is the number of integral solutions.
示例1

输入

复制
2
2 2 3
6 2 36

输出

复制
Case #1: 13
Case #2: 301