Codeforces Round 186 (Div. 2) |
---|
Finished |
Ilya has recently taken up archaeology. He's recently found two numbers, written in the m-based notation. Each of the found numbers consisted of exactly n digits. Ilya immediately started looking for information about those numbers. He learned that the numbers are part of a cyphered code and the one who can decypher it can get the greatest treasure.
After considerable research Ilya understood that to decypher the code, he should do the following:
Help Ilya, find the key to the code.
The first line contains two integers n, m (1 ≤ n, m ≤ 105, m > 1). The second line contains the first found number, the third line contains the second found number.
The numbers are recorded as a sequence of digits in the m-based notation. Each digit is an integer from 0 to m - 1. The digits in the line are written in the order from the most significant digits to the least significant ones.
The given numbers can contain leading zeroes.
Print n m-base digits. The resulting third number written in the m-based notation. Print the digits in the order from the most significant digits to the least significant ones.
4 7
5 4 3 2
5 6 5 4
6 4 2 1
5 5
2 4 4 1 3
1 0 1 2 4
4 4 4 3 2
Name |
---|