## Bitwise Convolution 6

##### Bitwise Convolution Exercise 6

Exercise 1: Bitwise XOR convolution

Exercise 2: Bitwise OR convolution

Exercise 3: Bitwise AND convolution

Exercise 4: An operation that ORs the first bit, ANDs the second bit, and then repeats.

Exercise 5: An operation that ORs the first bit, ANDs the second bit, XORs the third one, and then repeats.

**Exercise 6: XOR in base 3 (addition with no carry).**

#### Input and Output Specification

The first line contains the integers () and (), the exercise number and the length of the vectors and . The next line will contain and the line after will contain .

You will ouput the vector up until the last non-zero entry, where is the convolution operation of the respective subtask. **Please output these numbers modulo .**

#### Sample Input 1

```
6 3
1 2 3
1 1 2
```

#### Sample Output 1

`8 9 7`

#### Explanation

We are given that . Let denote the base-3 XOR (sum of digits in base 3 without carrying) operation.

, so we add to .

, so we add to .

, so we add to .

#### Sample Input 2

```
6 4
1 2 2 2
1 1 2 3
```

#### Sample Output 2

`7 7 6 5 8 10 6`

#### Sample Input 3

```
6 2
0 0
0 0
```

#### Sample Output 3

## Comments