#include const int N = 1000010; const int M = 1000000007; int n; int f[N]; int main() { f[0] = 1; f[1] = 1; for (int i = 2; i < N; i++) { f[i] = ((long long)(i - 1) * f[i - 2] + f[i - 1]) % M; } scanf("%d", &n); for (int i = 1; i <= n; i++) { int x; scanf("%d", &x); printf("Case #%d:\n%d\n", i, f[x]); } return 0; }