Rikka has n disks of distinct sizes on three rods. Each move consists of taking the upper disk from one of the stacks and placing it on top of another stack. No disk can be placed on top of a smaller disk.
Given the configuration of disks S and T, find the number of ways can Rikka transform from S to T in no more than m moves.
As the number of ways can be very large, find it modulo 998,244,353.
Two sequences of moves are different if they have different lengths, or the configurations are different after some moves.
The first line contains two integers n and m (1≤n≤100, 0≤m≤100).
The second line contains n integers a_1,a_2,…,a_n, the configuration S (1≤a_i≤3). These mean that the i-th smallest disk is on rod a_i.
The third line contains n integers b_1,b_2,…,b_n, the configuration T given in the same format (1≤b_i≤3).
Print one integer: the number of ways modulo 998,244,353.