#include <bits/stdc++.h>
using namespace std;
typedef unsigned long long uLL;
typedef pair<int, int> pii;
typedef long double LD;
typedef long long LL;
typedef double db;
const int N = 500000;
const LL P = 998244353, G = 3, Gi = 332748118;
const LL inv2 = 499122177;
LL Pow(LL x, LL y) {
LL res = 1;
for (; y; y >>= 1, x = x * x % P)
if (y & 1) res = res * x % P;
return res;
}
int rev[N];
typedef vector<LL> poly;
inline LL ADD(LL x, LL y) { return (x += y) >= P ? x - P : x; }
inline LL DEL(LL x, LL y) { return (x -= y) < 0 ? x + P : x; }
void csz(poly &x, int n = 0) { x.resize(n), x.shrink_to_fit(); }
LL wn[N];
int pre(int len) {
int i, j, tg, n = 1;
while (n < len) n <<= 1;
for (i = 1, wn[j = n >> 1] = 1; i < n; i++)
rev[i] = (rev[i >> 1] >> 1) | ((i & 1) ? j : 0);
for (i = j + 1, tg = Pow(Gi, (P - 1) / n); i < n; i++) wn[i] = wn[i - 1] * tg % P;
for (i = j - 1; i > 0; i--) wn[i] = wn[i << 1];
return n;
}
void ntt(poly &a, int n, int op = 0) {
static LL f[N], *u, *v, *w, sv;
int i, j, k; csz(a, n);
for (i = 0; i < n; i++) f[i] = a[rev[i]];
for (i = 1; i < n; i <<= 1)
for (j = 0; j < n; j += i << 1)
for (k = 0, w = wn + i, u = f + j, v = u + i; k < i; k++)
sv = w[k] * v[k] % P, v[k] = DEL(u[k], sv), u[k] = ADD(u[k], sv);
if (op) for (i = 0, sv = Pow(n, P - 2), reverse(f + 1, f + n); i < n; i++) f[i] = f[i] * sv % P;
a.assign(f, f + n);
}
poly operator * (poly a, poly b) {
const int n = a.size() + b.size() - 1, deg = pre(n);
ntt(a, deg), ntt(b, deg);
for (int i = 0; i < deg; i++) a[i] = a[i] * b[i] % P;
return ntt(a, deg, 1), csz(a, n), a;
}
int n, m;
poly f, g;
int main() {
ios::sync_with_stdio(false);
cin.tie(0), cout.tie(0);
cin >> n >> m, ++n, ++m;
csz(f, n), csz(g, m);
for (int i = 0; i < n; i++) cin >> f[i];
for (int i = 0; i < m; i++) cin >> g[i];
f = f * g;
for (int i = 0; i < n + m - 1; i++) cout << f[i] << ' ';
}