/*
* Author: Kewth
* Date:
echo -n ' ' && date +%Y.%m.%d # Type "!!sh" in Vim.
* Solution:
To be updated after "Accept".
* Digression:
* CopyRight:
▁▃▄▄▄▃▃▃▃▄▶
▗▇▀▔ ▔▔▔▔
▄▛ ▃▅━━■▄▂
▟▊ ▐▘ ▀▙
▟▜▌ ▐▖ ▋ ▐▍
▟▘ ▜ ▝▀▇▆■▘ ▐▌
▗▟▘ ▜▃ ▁▅▛
▔▀▼▅▄▃▃██▅▄▄▄▅■▀▔
▔▔▔▔▔▔
*/
#include <cstdio>
#include <algorithm>
#define debug(...) fprintf(stderr, __VA_ARGS__)
typedef long long ll;
typedef unsigned long long ull;
static struct {
inline operator int () { int x; return scanf("%d", &x), x; }
template<class T> inline void operator () (T &x) { x = *this; }
} read;
const int maxl = 1 << 18, mod = 998244353;
int R[maxl << 1], G[maxl];
inline ll power (ll x, int k) {
if (k < 0) k += mod - 1;
ll res = 1;
while (k) {
if (k & 1) (res *= x) %= mod;
(x *= x) %= mod;
k >>= 1;
}
return res;
}
void init () {
for (int n = 1; n <= maxl; n <<= 1) {
int *r = R + n;
for (int i = 1; i < n; i ++)
r[i] = r[i >> 1] >> 1 | (i & 1) * (n >> 1);
}
ll g = power(3, (mod - 1) / maxl);
G[maxl / 2] = 1;
for (int i = maxl / 2 + 1; i < maxl; i ++) G[i] = G[i - 1] * g % mod;
for (int i = maxl / 2 - 1; i; i --) G[i] = G[i << 1];
}
void dft (int *b, int n) {
static ull a[maxl];
for (int i = 0; i < n; i ++) a[i] = ull(b[R[n + i]]);
for (int m = 1; m < n; m <<= 1)
for (int i = 0; i < n; i += m << 1)
for (int k = i; k < i + m; k ++) {
ull x = a[k], y = a[k + m] * ull(G[m + k - i]) % mod;
a[k] = x + y;
a[k + m] = x + mod - y;
}
for (int i = 0; i < n; i ++) b[i] = a[i] % mod;
}
void idft (int *a, int n) {
std::reverse(a + 1, a + n), dft(a, n);
ll inv = mod - (mod - 1) / n;
for (int i = 0; i < n; i ++) a[i] = inv * a[i] % mod;
}
void polyinv (int *a, int n) {
static int t[maxl], b[maxl];
b[0] = int(power(a[0], -1));
for (int m = 2; m <= n; m <<= 1) {
std::copy(a, a + m, t);
std::fill(t + m, t + (m << 1), 0);
dft(t, m << 1), dft(b, m << 1);
for (int i = 0; i < (m << 1); i ++)
b[i] = ll(2 + ll(mod - t[i]) * b[i]) % mod * b[i] % mod;
idft(b, m << 1);
std::fill(b + m, b + (m << 1), 0);
}
std::copy(b, b + n, a);
}
int a[maxl], b[maxl];
int main () {
init();
int n = read, m = read, l = 1;
while (l < n + m + 1) l <<= 1;
for (int i = 0; i <= n; i ++) read(a[i]);
for (int i = 0; i <= m; i ++) read(b[i]);
dft(a, l), dft(b, l);
for (int i = 0; i < l; i ++) a[i] = 1ll * a[i] * b[i] % mod;
idft(a, l);
for (int i = 0; i <= n + m; i ++) printf("%d ", a[i]); puts("");
}