#include<cstdio>
#include<cstring>
#include<iostream>
#define rep(i,a,b) for (register int i=a; i<=b; i++)
#define per(i,a,b) for (register int i=a; i>=b; --i)
using namespace std;
const int N = 280000, mo = 998244353;
int n,m,a[N],b[N],c[N],w[N];
inline void read(int &x) {
x=0; char c=getchar();
while (!isdigit(c)) c=getchar();
while (isdigit(c)) {x=x*10+c-'0'; c=getchar();}
}
inline int power(int a, int n) {
int res=1;
while (n) {
if (n&1) res=1LL*res*a%mo;
a=1LL*a*a%mo; n>>=1;
}
return res;
}
inline void exgcd(int a, int b, int &x, int &y) {
if (!b) {x=1; y=0; return;}
exgcd(b,a%b,y,x); y-=a/b*x;
}
inline int inv(int a) {int x,y; exgcd(a,mo,x,y); return x>=0 ? x : x+mo;}
inline void getmod(int &x){x+=x>>31&mo;}
inline void fft(int *a, int n, int tp) {
for (int i=1,j=0; i<n; i++) {
for (int k=n>>1; !((j^=k)&k); k>>=1);
if (i<j) swap(a[i],a[j]);
}
for (int j=2; j<=n; j<<=1) {
w[0]=1; w[1]=power(3,(mo-1)/j); w[1]=tp==1?w[1]:inv(w[1]); int m=(j>>1)-1; //mo-1
rep(i,2,m) w[i]=1LL*w[i-1]*w[1]%mo;
for (register int i=0; i<n; i+=j) rep(k,0,m) {
int x=1LL*a[i+k+(j>>1)]*w[k]%mo;
getmod(a[i+k+(j>>1)]=a[i+k]-x);
getmod(a[i+k]=a[i+k]+x-mo);
}
}
}
inline void mul(int *a, int *b, int l1, int l2, int *c){//a[0..l1]*b[0..l2]-->c[0..l1+l2]
int n;for(n=1;n<=l1+l2;n<<=1);
rep(i,l1+1,n-1)a[i]=0;rep(i,l2+1,n-1)b[i]=0;
fft(a,n,1);fft(b,n,1);rep(i,0,n-1)a[i]=1LL*a[i]*b[i]%mo;
fft(a,n,-1);int ni=inv(n);rep(i,0,l1+l2)c[i]=1LL*a[i]*ni%mo;
}
int main() {
// freopen("1.in","r",stdin);
read(n); read(m);
rep(i,0,n) read(a[i]);
rep(i,0,m) read(b[i]);
mul(a,b,n,m,c);int len=n+m;
for (int i=0;i<=len;i++) printf("%d ",c[i]);
return 0;
}