#include #include #include using namespace std; const int MOD = 1000000007; const int MAXN = 100000 + 5; int tn, n, m, depth, x, a[MAXN], b[MAXN], dp[2][MAXN], ways[MAXN]; int main(int argc, const char * argv[]) { tn = 1; while (tn--) { cin >> n >> m >> depth; assert(1 <= n && n <= 100000); assert(1 <= m && m <= 100000); assert(1 <= depth && depth <= 1000); for(int i = 0; i <= depth; i++) a[i] = b[i] = 0; for(int i = 0; i < n; i++) { cin >> x; assert(1 <= x && x <= depth); ++a[x]; } for(int i = 0; i < m; i++) { cin >> x; assert(1 <= x && x <= depth); ++b[x]; } for(int i = 1; i <= depth; i++) ways[i] = (a[i] * 1LL * b[i]) % MOD; for(int i = 0; i < 2; i++) for(int j = 0; j <= depth; j++) dp[i][j] = 0; dp[0][0] = 1; int l = 0, p = 1; for(int i = 1; i <= depth + 1; i++) { p = l; l ^= 1; for(int j = 1; j <= depth; j++) dp[l][j] = 0; int sum = 0, ret = 0; for(int j = i; j <= depth; j++) { sum = (sum + dp[p][j - 1]) % MOD; dp[l][j] = (sum * 1LL * ways[j]) % MOD; } if (i > 2) cout << (sum + dp[p][depth]) % MOD << " "; } cout << "0" << endl; } return 0; }