Problem:
Score : 100 points

Problem Statement

You are given two integer arrays a_0, a_1, ..., a_{N - 1} and b_0, b_1, ..., b_{M - 1}. Calculate the array c_0, c_1, ..., c_{(N - 1) + (M - 1)}, defined by c_i = \sum_{j = 0}^i a_j b_{i - j} \bmod 998244353.

Constraints

1 \leq N, M \leq 524288

0 \leq a_i, b_i < 998244353

All values in Input are integer.

Input

Input is given from Standard Input in the following format:

N M
a_0 a_1 ... a_{N-1}
b_0 b_1 ... b_{M-1}

Output

Print the answer in the following format:

c_0 c_1 ... c_{(N - 1) + (M - 1)}

Sample Input 1

4 5
1 2 3 4
5 6 7 8 9

Sample Output 1

5 16 34 60 70 70 59 36

Sample Input 2

1 1
10000000
10000000

Sample Output 2

871938225

Solution in Python (3.8.2) (judge verdict: Wrong Answer)

'''
参考:
https://maspypy.com/%E6%95%B0%E5%AD%A6%E3%83%BBnumpy-%E9%AB%98%E9%80%9F%E3%83%95%E3%83%BC%E3%83%AA%E3%82%A8%E5%A4%89%E6%8F%9Bfft%E3%81%AB%E3%82%88%E3%82%8B%E7%95%B3%E3%81%BF%E8%BE%BC%E3%81%BF
'''

import numpy as np
from numpy.fft import rfft,irfft

def convolve(a1,a2):
    n = 2**(len(a1)+len(a2)+1).bit_length()
    b1,b2=np.zeros(n),np.zeros(n)
    b1[:len(a1)], b2[:len(a2)]= a1,a2
    return (irfft(rfft(b1)*rfft(b2))+0.5).astype(int)
  
def convolve_large(f,g,mod,shift=15):
  f1,f2 = np.divmod(f,1<<shift)
  g1,g2 = np.divmod(g,1<<shift)
  
  a = convolve(f1,g1) % mod
  c = convolve(f2,g2) % mod
  b = (convolve(f1+f2,g1+g2) - (a+c)) % mod
  
  h = (a << shift*2) + (b << shift) + c
  return h % mod

def convolve_large2(f,g,mod,shift=15):
  f1,f2 = np.divmod(f,1<<shift)
  g1,g2 = np.divmod(g,1<<shift)
  
  a = convolve_large(f1,g1,mod,shift) % mod
  c = convolve_large(f2,g2,mod,shift) % mod
  b = (convolve_large(f1+f2,g1+g2,mod,shift) - (a+c)) % mod
  
  h = (a << shift*2) + (b << shift) + c
  return h % mod 

N,M=map(int,input().split())
*A,=map(int,input().split())
*B,=map(int,input().split())
mod = 998244353

print(*convolve_large2(A,B,mod,30)[:N+M-1])