MOD = 998244353
SIZE = 60
MASK = (1 << SIZE) - 1
n, m = gets.split.map &:to_i
a = gets.split.map &:to_i
b = gets.split.map &:to_i

a_bn = 0
a.each_with_index do |a_i, i|
  a_bn |= a_i << SIZE * i
end

b_bn = 0
b.each_with_index do |b_j, j|
  b_bn |= b_j << SIZE * j
end

c_bn = a_bn * b_bn
c = []
(n + m - 1).times do |k|
  c << (c_bn >> SIZE * k & MASK) % MOD
end

puts c.join(" ")
