#include #include #include #include #include #include #include #include #include #include #define FS first #define SE second #define lson (o << 1), L, M #define rson ((o << 1) | 1), M + 1, R #define lc (o << 1) #define rc ((o << 1) | 1) using namespace std; typedef long long LL; const int MAXN = 1000000 + 10; const int mod = 1000000007; LL d[MAXN]; int main() { d[1] = 1; d[0] = 1; for(int i = 2 ; i < MAXN ; i++) d[i] = (d[i - 1] + (i - 1) * d[i - 2]) % mod; int T; scanf("%d", &T); int ca = 1; while(T--) { int n; scanf("%d", &n); printf("Case #%d:\n", ca++); printf("%I64d\n", d[n]); } return 0; } /* */