Simply Loopy 

Given an integer n, print what the following function (written in C++) will return:

long long unsigned lol(int n)
{
    long long unsigned ret = 0 , i , j , k , l , m , M = 7477777 ;

    for( i = 1 ; i <= n ; i++ )
        for( j = 1 ; j <= n ; j++ )
            for( k = 1 ; k <= n ; k++ )
                for( l = 1 ; l <= n ; l++ )
                    for( m=1 ; m <= n ; m++ )
                        if( i + j + k + l + m == n )
                           ret = (ret + i*i + j*j + k*k + l*l + m*m)%M ;

    return ret ;
}

Input 

First line of input will contain the number of test cases, T$ \le$600. Then there follows T lines, each containing an integer n ( 1$ \le$n$ \le$105).

Output 

For each case, print the case number starting from 1 and the value returned by the function `lol(n)'. See the sample output for exact formatting.


Note: A straight forward implementation of the given function may take millions of years, even for the fastest computers!

Sample Input 

3
5
6
7

Sample Output 

Case 1: 5
Case 2: 40
Case 3: 175


Problem Setter: Momontho Mashak Monmoy
Alternate Solution: Muhammad Ridowan, Md. Shiplu Hawlader