#include #define LL long long using namespace std; const int N = 1000000007; LL s[1000005]; void x(){ s[0] = s[1] = 1; for(int i = 2; i <= 1000000; i++) s[i] = (s[i - 1] + (i - 1) * s[i - 2]) % N; } int main(){ x(); int T, n; scanf("%d", &T); for(int t = 1; t <= T; t++){ scanf("%d", &n); printf("Case #%d:\n%d\n", t, s[n]); } return 0; }