#include <cstdio> #include <cmath> #define Maxn 5000 #define Pi 3.1415926535898 using namespace std; int n,m; struct complex {complex (double xx=0,double yy=0){x=xx,y=yy;} double x,y;}; complex operator + (complex a,complex b){ return complex(a.x+b.x,a.y+b.y); }complex operator - (complex a,complex b){ return complex(a.x-b.x,a.y-b.y); }complex operator * (complex a,complex b){ return complex(a.x*b.x-a.y*b.y,a.x*b.y+a.y*b.x); }complex w[Maxn],b[Maxn],c[Maxn]; void fft(complex *f,int len,short op) { if (!len)return ; complex fl[len+1],fr[len+1]; for (int k=0;k<len;k++) {fl[k]=f[k<<1];fr[k]=f[k<<1|1];} fft(fl,len>>1,op); fft(fr,len>>1,op); complex tmp,buf; tmp=complex(cos(Pi/len),sin(Pi/len)*op); buf.x=1;buf.y=0; for (int k=0;k<len;k++){ complex t=buf*fr[k]; f[k]=fl[k]+t; f[k+len]=fl[k]-t; buf=buf*tmp; } } int main() { scanf("%d%d",&n,&m); for (int i=0;i<=n;i++)scanf("%lf",&b[i].x); for (int i=0;i<=m;i++)scanf("%lf",&c[i].x); for(m+=n,n=1;n<=m;n<<=1); fft(b,n>>1,1); fft(c,n>>1,1); for(int i=0;i<n;++i)b[i]=b[i]*c[i]; fft(b,n>>1,-1); for(int i=0;i<=m;++i)printf("%.0f ",fabs(b[i].x)/n); puts(""); return 0; }