// Template
#include <bits/stdc++.h>
#define rep_override(x, y, z, name, ...) name
#define rep2(i, n) for (int i = 0; i < (int)(n); ++i)
#define rep3(i, l, r) for (int i = (int)(l); i < (int)(r); ++i)
#define rep(...) rep_override(__VA_ARGS__, rep3, rep2)(__VA_ARGS__)
#define per(i, n) for (int i = (int)(n) - 1; i >= 0; --i)
#define all(x) (x).begin(), (x).end()
using namespace std;
using ll = long long;
constexpr int inf = 1001001001;
constexpr ll INF = 3003003003003003003LL;
template <typename T> inline bool chmin(T& x, const T& y) {if (x > y) {x = y; return 1;} return 0;}
template <typename T> inline bool chmax(T& x, const T& y) {if (x < y) {x = y; return 1;} return 0;}
struct IOSET {IOSET() {cin.tie(0); ios::sync_with_stdio(0); cout << fixed << setprecision(10);}} ioset;

// Number-Theoretical Transform
// for example, 998244353, 1012924417, 1811939329
template <int mod>
class NumberTheoreticalTransform {
    std::vector<long long> zeta, inv_zeta;
    inline int power(int x, int y) {
        if (!y) return 1;
        long long a = power(x, y / 2);
        if (y & 1) return a * a % mod * x % mod;
        return a * a % mod;
    }
    inline long long add(long long x, long long y) {
        if ((x += y) >= mod) x -= mod;
        return x;
    }
    void dft(std::vector<long long> &a, size_t exponents) {
        size_t m = 1 << exponents, now_e = exponents;
        while (m > 1) {
            for (size_t i = 0; i < a.size() / m; ++i) {
                long long now = 1;
                for (size_t j = 0; j < m / 2; ++j) {
                    long long l = a[m * i + j];
                    long long r = a[m * i + j + m / 2];
                    a[m * i + j] = add(l, r);
                    a[m * i + j + m / 2] = add(l, mod - r) * now % mod;
                    now = now * zeta[now_e] % mod;
                }
            }
            m /= 2;
            --now_e;
        }
    }
    void idft(std::vector<long long> &a, size_t exponents) {
        size_t m = 2, now_e = 1;
        while (m <= a.size()) {
            for (size_t i = 0; i < a.size() / m; ++i) {
                long long now = 1;
                for (size_t j = 0; j < m / 2; ++j) {
                    long long l = a[m * i + j];
                    long long r = a[m * i + j + m / 2] * now % mod;
                    a[m * i + j] = add(l, r);
                    a[m * i + j + m / 2] = add(l, mod - r);
                    now = now * inv_zeta[now_e] % mod;
                }
            }
            m <<= 1;
            ++now_e;
        }
    }
public:
    constexpr NumberTheoreticalTransform() {
        size_t exponents = 0;
        int tmp = mod - 1;
        while (not (tmp & 1)) {
            tmp /= 2;
            ++exponents;
        }
        int root = 2;
        while (power(root, (mod - 1) / 2) == 1) ++root;
        root = power(root, tmp);
        zeta.resize(exponents + 1);
        inv_zeta.resize(exponents + 1);
        zeta[exponents] = root;
        inv_zeta[exponents] = power(root, mod - 2);
        for (size_t i = exponents; i > 0; --i) {
            zeta[i - 1] = zeta[i] * zeta[i] % mod;
            inv_zeta[i - 1] = inv_zeta[i] * inv_zeta[i] % mod;
        }
    }
    std::vector<long long> multiply(std::vector<long long> &f, std::vector<long long> &g) {
        size_t siz = 1, exp = 0;
        while (siz < f.size() + g.size()) {
            siz *= 2;
            ++exp;
        }
        std::vector<long long> nf(siz, 0), ng(siz, 0);
        for (size_t i = 0; i < f.size(); ++i) nf[i] = f[i];
        for (size_t i = 0; i < g.size(); ++i) ng[i] = g[i];
        dft(nf, exp);
        dft(ng, exp);
        for (size_t i = 0; i < siz; ++i) nf[i] = nf[i] * ng[i] % mod;
        idft(nf, exp);
        long long inv = power((int)siz, mod - 2);
        for (size_t i = 0; i < siz; ++i) nf[i] = nf[i] * inv % mod;
        while (nf.size() > f.size() + g.size() - 1) nf.pop_back();
        return nf;
    }
};

// Main
constexpr int MOD = 998244353;

int main() {
    int n, m;
    cin >> n >> m;
    vector<ll> a(n), b(m);
    rep(i, n) cin >> a[i];
    rep(i, m) cin >> b[i];
    
    NumberTheoreticalTransform<MOD> ntt;
    
    vector<ll> ans = ntt.multiply(a, b);
    for (ll x : ans) cout << x << " ";
    cout << "\n";
    return 0;
}


Measured memory_bytes: 27764