#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 = 3e6 + 5;
const LL P = 998244353, G = 3, Gi = 332748118;
void add(LL &x, LL y) { (x += P + y % P) %= P; }
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];
struct poly : vector<LL> {
using vector::vector;
using vector::operator[];
void clr() { clear(), shrink_to_fit(); }
void set(int n) { resize(n); }
} ;
int pre(int n) {
int deg = 1;
while (deg < n) deg <<= 1;
for (int i = 1; i < deg; i++)
rev[i] = (rev[i >> 1] >> 1) | ((i & 1) * (deg >> 1));
return deg;
}
void NTT(poly &a, int deg, int op) {
a.set(deg);
for (int i = 0; i < deg; i++)
if (i < rev[i]) swap(a[i], a[rev[i]]);
LL wn, w, x, y;
for (int i = 1; i < deg; i <<= 1) {
wn = Pow(op == 1 ? G : Gi, (P - 1) / (i << 1));
for (int j = 0; j < deg; j += (i << 1)) {
w = 1;
for (int k = 0; k < i; k++) {
x = a[j + k], y = w * a[i + j + k] % P;
a[j + k] = (x + y) % P;
a[i + j + k] = (x - y + P) % P;
w = w * wn % P;
}
}
}
if (op == -1) {
wn = Pow(deg, P - 2);
for (LL &o : a) o = o * wn % P;
}
}
poly operator * (poly f, poly g) {
if (f.empty() || g.empty()) return {};
int n = f.size() + g.size() - 1;
int deg = pre(n);
NTT(f, deg, 1), NTT(g, deg, 1);
for (int i = 0; i < deg; i++)
f[i] = f[i] * g[i] % P;
NTT(f, deg, -1);
f.set(n);
return f;
}
poly f, g;
int main() {
ios::sync_with_stdio(false);
cin.tie(0), cout.tie(0);
int n, m;
cin >> n >> m;
++n, ++m;
f.resize(n), g.resize(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 (LL x : f) cout << x << ' ';
}