1 #include<cstdio>
2 #include<iostream>
3
4 using namespace std;
5
6 inline int check(int x){
7 int ans = 0;
8 while(x){
9 ans += x / 5;
10 x /= 5;
11 }
12 return ans;
13 }//处理5的个数,即末尾0的个数
14
15 int main(){
16 int t, m = 0;
17 scanf("%d", &t);
18 while(t--){
19 int ans = 0, a;
20 m++;
21 scanf("%d", &a);
22 int l = 1, r = 5e8 + 5;
23 while(l <= r){
24 int mid = (l + r) >> 1;
25 int _mid = check(mid);
26 if(_mid > a) r = mid - 1;
27 else if(_mid < a) l = mid + 1;
28 else if(_mid == a) {ans = mid; r = mid - 1;}//可能有答案遗漏
29 }
30 if(ans) printf("Case %d: %d
", m, ans);
31 else printf("Case %d: impossible
", m);
32 }
33 return 0;
34 }