n=1 --> ans = 2 = 1*2 = 2^0(2^0+1)
n=2 --> ans = 6 = 2*3 = 2^1(2^1+1)
n=3 --> ans = 20 = 4*5 = 2^2(2^2+1)
n=4 --> ans = 72 = 8*9 = 2^3(2^3+1)
n=k --> ??? = 2^k-1*(2^k-1+1)
于是题目转化为快速幂求模问题.....
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int solve(ll a, ll b) {
ll ans = ;
a %= ;
while(b) {
if(b&) ans = ans *a % ;
b /= ;
a = a * a % ;
}
return ans;
}
int main() {
int t;
while(cin >> t && t) {
for(int i = ; i <= t; i++) {
ll n;
cin >> n;
n = solve(, n-);
printf("Case %d: %d\n", i, (n*(n+))%);
}
printf("\n");
}
return ;
}