class Convolution():
    def __init__(self, mod):
        self.mod = mod
        self.root = self.primitive_root(mod)
        self.first1 = True
        self.first2 = True
        self.sum_e = [0] * 30
        self.sum_ie = [0] * 30

    def primitive_root(self, m):
        if m == 2: return 1
        if m == 167772161: return 3
        if m == 469762049: return 3
        if m == 754974721: return 11
        if m == 998244353: return 3
        divs = [0] * 20
        cnt = 1
        x = (m - 1) // 2
        while x % 2 == 0: x //= 2
        i = 3
        while i * i <= x:
            if x % i == 0:
                divs[cnt] = i
                cnt += 1
                while x % i == 0: x //= i
            i += 2
        if x > 1:
            divs[cnt] = x
            cnt += 1
        g = 2
        while True:
            for i in range(cnt):
                if pow(g, (m - 1) // divs[i], m) == 1: break
            else:
                return g
            g += 1

    def inv_gcd(self, a, b):
        a %= b
        if a == 0: return b, 0
        s = b
        t = a
        m0 = 0
        m1 = 1
        while t:
            u = s // t
            s -= t * u
            m0 -= m1 * u
            s, t = t, s
            m0, m1 = m1, m0
        if m0 < 0: m0 += b // s
        return s, m0

    def butterfly(self, arr):
        mod = self.mod
        g = self.root
        n = len(arr)
        h = (n - 1).bit_length()
        if self.first1:
            self.first1 = False
            es = [0] * 30
            ies = [0] * 30
            m = mod - 1
            cnt2 = (m & -m).bit_length() - 1
            e = pow(g, m >> cnt2, mod)
            ie = pow(e, mod - 2, mod)
            for i in range(cnt2 - 1)[::-1]:
                es[i] = e
                ies[i] = ie
                e *= e
                e %= mod
                ie *= ie
                ie %= mod
            now = 1
            for i in range(cnt2 - 2):
                self.sum_e[i] = es[i] * now % mod
                now *= ies[i]
                now %= mod
        for ph in range(1, h + 1):
            w = 1 << (ph - 1)
            p = 1 << (h - ph)
            now = 1
            for s in range(w):
                offset = s << (h - ph + 1)
                for i in range(p):
                    l = arr[i + offset]
                    r = arr[i + offset + p] * now
                    arr[i + offset] = (l + r) % mod
                    arr[i + offset + p] = (l - r) % mod
                now *= self.sum_e[(~s & -~s).bit_length() - 1]
                now %= mod

    def butterfly_inv(self, arr):
        mod = self.mod
        g = self.root
        n = len(arr)
        h = (n - 1).bit_length()
        if self.first2:
            self.first2 = False
            es = [0] * 30
            ies = [0] * 30
            m = mod - 1
            cnt2 = (m & -m).bit_length() - 1
            e = pow(g, m >> cnt2, mod)
            ie = pow(e, mod - 2, mod)
            for i in range(cnt2 - 1)[::-1]:
                es[i] = e
                ies[i] = ie
                e *= e
                e %= mod
                ie *= ie
                ie %= mod
            now = 1
            for i in range(cnt2 - 2):
                self.sum_ie[i] = ies[i] * now % mod
                now *= es[i]
                now %= mod
        for ph in range(1, h + 1)[::-1]:
            w = 1 << (ph - 1)
            p = 1 << (h - ph)
            inow = 1
            for s in range(w):
                offset = s << (h - ph + 1)
                for i in range(p):
                    l = arr[i + offset]
                    r = arr[i + offset + p]
                    arr[i + offset] = (l + r) % mod
                    arr[i + offset + p] = (mod + l - r) * inow % mod
                inow *= self.sum_ie[(~s & -~s).bit_length() - 1]
                inow %= mod

    def convolution(self, a, b):
        mod = self.mod
        n = len(a)
        m = len(b)
        if not n or not m: return []
        if min(n, m) <= 50:
            if n < m:
                n, m = m, n
                a, b = b, a
            res = [0] * (n + m - 1)
            for i in range(n):
                for j in range(m):
                    res[i + j] += a[i] * b[j]
                    res[i + j] %= mod
            return res
        z = 1 << (n + m - 2).bit_length()
        a += [0] * (z - n)
        b += [0] * (z - m)
        self.butterfly(a)
        self.butterfly(b)
        for i in range(z):
            a[i] *= b[i]
            a[i] %= mod
        self.butterfly_inv(a)
        a = a[:n + m - 1]
        iz = pow(z, mod - 2, mod)
        for i in range(n + m - 1):
            a[i] *= iz
            a[i] %= mod
        return a

    def convolution_ll(self, a, b):
        n = len(a)
        m = len(b)
        if not n or not m: return []
        mod1 = 754974721
        mod2 = 167772161
        mod3 = 469762049
        m2m3 = mod2 * mod3
        m1m3 = mod1 * mod3
        m1m2 = mod1 * mod2
        m1m2m3 = mod1 * mod2 * mod3
        i1 = self.inv_gcd(m2m3, mod1)[1]
        i2 = self.inv_gcd(m1m3, mod2)[1]
        i3 = self.inv_gcd(m1m2, mod3)[1]
        c1 = self.convolution(a.copy(), b.copy(), mod1)
        c2 = self.convolution(a.copy(), b.copy(), mod2)
        c3 = self.convolution(a.copy(), b.copy(), mod3)
        c = [0] * (n + m - 1)
        for i in range(n + m - 1):
            x = 0
            x += (c1[i] * i1) % mod1 * m2m3
            x += (c2[i] * i2) % mod2 * m1m3
            x += (c3[i] * i3) % mod3 * m1m2
            x %= m1m2m3
            c[i] = x
        return c

import sys
input = sys.stdin.buffer.readline

N, M = map(int, input().split())
A = [int(x) for x in input().split()]
B = [int(x) for x in input().split()]

cv = Convolution(998244353)

print(*cv.convolution(A, B))

Measured memory_bytes: 192744