#include #include #define LL long long using namespace std;; const int N = 1000010; const LL mod = 1000000007; LL dp[N]; int main() { int T, n, kase = 1; scanf("%d", &T); dp[1] = 1, dp[2] = 2; for (int i = 3; i < N; ++i) dp[i] = (dp[i - 1] + (i - 1) * dp[i - 2]) % mod; while (T--) { scanf("%d", &n); printf("Case #%d:\n%I64d\n", kase++, dp[n]); } return 0; }