Codeforces Round 609 (Div. 2)


A. Equation
time limit per test: 3 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
1
Output
9 8
Input
512
Output
4608 4096
----------------------------------------------------------------------------------------------------
B. Modulo Equality
time limit per test: 3 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
4 3
0 0 2 1
2 0 1 1
Output
1
Input
3 2
0 0 0
1 1 1
Output
1
Input
5 10
0 0 0 1 2
2 1 0 0 0
Output
0
----------------------------------------------------------------------------------------------------
C. Long Beautiful Integer
time limit per test: 3 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
3 2
353
Output
3
353
Input
4 2
1234
Output
4
1313
----------------------------------------------------------------------------------------------------
D. Domino for Young
time limit per test: 3 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
5
3 2 2 2 1
Output
4
----------------------------------------------------------------------------------------------------
E. K Integers
time limit per test: 3 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
5
5 4 3 2 1
Output
0 1 3 6 10 
Input
3
1 2 3
Output
0 0 0 
----------------------------------------------------------------------------------------------------
