poly calcpow(poly a, int m) { auto solve = [&](auto &self, poly &a, int l, int r) -> poly { if (l == r) return {1, a[l]}; int mid = (l + r) >> 1; returnself(self, a, l, mid) * self(self, a, mid + 1, r); }; auto b = solve(solve, a, 0, a.size() - 1); b.resize(m + 1), b = Ln(b); for (int i = 0; i <= m; ++ i) { if (!(i & 1)) adj(b[i] = -b[i]); b[i] = (LL) b[i] * i % Mod; } return b; }
intmain() { init(); int n, m, t; std::cin >> n >> m; poly a(n), b(m); for (int &x : a) scanf("%d", &x); for (int &x : b) scanf("%d", &x); std::cin >> t; a = calcpow(a, t), a[0] = n; for (int i = 0; i <= t; ++ i) a[i] = (LL) a[i] * infact[i] % Mod; b = calcpow(b, t), b[0] = m; for (int i = 0; i <= t; ++ i) b[i] = (LL) b[i] * infact[i] % Mod; a = a * b; int Inv = qpow((LL) n * m % Mod); for (int i = 0; i <= t; ++ i) a[i] = (LL) a[i] * fact[i] % Mod * Inv % Mod; for (int i = 1; i <= t; ++ i) printf("%d\n", a[i]); return0; }