# fork from: https://atcoder.jp/contests/practice2/submissions/16655600
# frozen_string_literal: true

require 'numo/narray'

def bsf(x)
  (x & -x).bit_length - 1
end

cnt2 = bsf(998244353 - 1)
e = 3.pow((998244353-1) >> cnt2, 998244353)
ie = e.pow(998244353 - 2, 998244353)

es = Numo::NArray.zeros(cnt2-1)
ies = Numo::NArray.zeros(cnt2-1)
cnt2.downto(2){ |i|
  es[i-2] = e
  ies[i-2] = ie
  e = e*e % 998244353
  ie = ie*ie % 998244353
}
now = inow = 1

sum_e = @sum_e = [0]*(cnt2-2)
sum_ie = @sum_ie = [0]*(cnt2-2)
(cnt2-2).times{ |i|
  sum_e[i] = es[i]*now % 998244353
  now = now*ies[i] % 998244353
  sum_ie[i] = ies[i]*inow % 998244353
  inow = inow*es[i] % 998244353
}

def convolution(a, b)
  n = a.size
  m = b.size
  return [] if n==0 || m==0

  h = (n+m-2).bit_length
  z = 1 << h

  a = a+[0]*(z-n)
  b = b+[0]*(z-m)

  batterfly(a, h)
  batterfly(b, h)

  c = (0 ... z).map{ |i| a[i]*b[i] % 998244353 }

  batterfly_inv(c, h)

  iz = z.pow(998244353-2, 998244353)
  return c[0,n+m-1].map{ |c| c*iz % 998244353 }
end

def batterfly(a, h)
  sum_e = @sum_e
  1.upto(h){ |ph|
    w = 1 << (ph-1)
    p = 1 << (h-ph)
    now = 1
    w.times{ |s|
      offset = s << (h-ph+1)
      offset.upto(offset+p-1){ |i|
        l = a[i]
        r = a[i+p]*now % 998244353
        a[i] = l+r
        a[i+p] = l-r
      }
      now = now*sum_e[bsf(~s)] % 998244353
    }
  }
end

def batterfly_inv(a, h)
  sum_ie = @sum_ie
  h.downto(1){ |ph|
    w = 1 << (ph-1)
    p = 1 << (h-ph)
    inow = 1
    w.times{ |s|
      offset = s << (h-ph+1)
      offset.upto(offset+p-1){ |i|
        l = a[i]
        r = a[i+p]
        a[i] = l+r
        a[i+p] = (l-r)*inow % 998244353
      }
      inow = inow*sum_ie[bsf(~s)] % 998244353
    }
  }
end

_, a, b = $<.map{ |e| e.split.map &:to_i }

puts convolution(a, b).join(?\s)
