#include #include #include #include #include #include #include #include #include #include using namespace std; #define LL long long #define N 1000020 #define M 2020 #define eps 1e-10 #define inf 0x3f3f3f3f #define Pi acos(-1.0) #define mod 1000000007 #pragma comment(linker, "/STACK:1024000000,1024000000") LL f[N]; int main(){ int kk = 0, cas; scanf("%d", &cas); f[1] = 1, f[2] = 2; for(int i = 3; i < N; ++i) f[i] = (f[i-1] + (i-1) * f[i-2]) % mod; while(cas--){ printf("Case #%d:\n", ++kk); int n; scanf("%d", &n); printf("%I64d\n", f[n]); } return 0; }