#include <stdio.h>
long long int p[10] = { 2, 1024, 976371285, 688423210, 905611805,
607723520, 235042059, 255718402, 494499948,
140625001};
int main()
{
int n, i, k, l;
long long int ans, tmp, m, copyM, j;
scanf("%d", &n);
for (i = 1; i <= n; i ++)
{
ans = 1;
scanf("%lld", &m);
copyM = m;
m --;
for (j = 1000000000, k = 9; j > 0; j /= 10, k --)
{
tmp = m / j;
m %= j;
if (tmp)
{
while (tmp --)
ans = ( ans * p[k]) % 1000000007;
}
}
ans = (ans * copyM) % 1000000007;
printf("Case #%d: %lld\n", i, ans);
}
return 0;
}
回目錄
回首頁
沒有留言 :
張貼留言