# Convolution (mod 1,000,000,007)

AC一覧

## Problem Statement問題文

Given integer sequences $a_0, a_1, ..., a_{N - 1}$ and $b_0, b_1, ..., b_{M - 1}$. Calculate an integer sequence $c_0, c_1, ..., c_{(N - 1) + (M - 1)}$ as follows:

$$c_i = \sum_{j = 0}^i a_j b_{i - j} \bmod 1{,}000{,}000{,}007$$

ただし、

$$c_i = \sum_{j = 0}^i a_j b_{i - j} \bmod 1{,}000{,}000{,}007$$

です

## Constraints制約

• $1 \leq N, M \leq 524{,}288$
• $0 \leq a_i, b_i < 1{,}000{,}000{,}007$

## Input入力

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


## Output出力

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


## Sampleサンプル

### # 1

4 5
1 2 3 4
5 6 7 8 9

5 16 34 60 70 70 59 36


### # 2

1 1
10000000
10000000

999300007


Timelimit: 10 secs

Before submitting, please confirm terms and conditions