Problems
10101 - Reverse Factorial
SUBMIT PROBLEM

Reverse Factorial

Time Limit: 1 sec

 

The Problem

In mathematics, the factorial of a non-negative integer n, denoted by n!, is the product of all positive integers less than or equal to n.

 

n! = n x (n-1) x (n-2) x … x 1

 

For example,

4! = 4 x 3 x 2 x 1 = 24

 

In this problem given the value of factorial n (n!), you need to find n.

 

The Input

The first line contains an integer number T, which indicates the number of test cases (0 < T 100). Each test case is given in one line. This line contains a positive integer numbers M which is the value of n! (0 < M 121645100408832000).

[Note: M is always a valid factorial value.]

 

The Output

For each test case, print a single line “Case X: n”, here X is the case number start from 1 to T and n is the answer of the given question.



Sample Input

3

24

1

120

 

Sample Output

Case 1: 4

Case 2: 1

Case 3: 5

 

 

 

[University Level]

ISCPC 2017 Preliminary Mock

Problem Setter: Shahin ShamS