Justice For Everyone

아직 제출이 없습니다시간 제한10초메모리 제한512 MB

문제

Suppose you have nn pairwise different numbers on a desk, denoted by a_1,a_2,,a_na\_1, a\_2, \ldots, a\_n (order matters). In one turn, you can choose two different indices i_1<i_2i\_1 < i\_2 and simultaneously increase a_i_1a\_{i\_1} and a_i_2a\_{i\_2} by one. The only condition is that the numbers on the desk should be different in every moment. Your task is to find the number of ways to obtain pairwise different numbers b_1,b_2,,b_nb\_1, b\_2, \ldots, b\_n (in exactly this order). As this number can be very large, print it modulo 998,244,353998\\,244\\,353.

입력

The first line of the input contains a single integer nn (1n301 \le n \le 30). The second and the third lines of the input contain nn space-separated integers each: the arrays a_ia\_i and b_ib\_i respectively (1a_i,b_i2001 \le a\_i, b\_i \le 200). All a_ia\_i are guaranteed to be pairwise different, same for b_ib\_i.

출력

Print the answer modulo prime number 998,244,353998\\,244\\,353.

힌트

In the first sample, the only way is to make operations in the order 2,3,1,3,1,2\\{2, 3\\}, \\{1, 3\\}, \\{1, 2\\}

In the third sample, we can make the three operations 1,2,2,3,1,3\\{1, 2\\}, \\{2, 3\\}, \\{1, 3\\} in any order.