Codeforces Round 186 (Div. 2)


A. Ilya and Bank Account
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
2230
Output
2230
Input
-10
Output
0
Input
-100003
Output
-10000
----------------------------------------------------------------------------------------------------
B. Ilya and Queries
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
......
4
3 4
2 3
1 6
2 6
Output
1
1
5
4
Input
#..###
5
1 3
5 6
1 5
3 6
3 4
Output
1
1
2
2
0
----------------------------------------------------------------------------------------------------
C. Ilya and Matrix
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
1
13
Output
13
Input
4
1 2 3 4
Output
14
----------------------------------------------------------------------------------------------------
D. Ilya and Roads
time limit per test: 3 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
10 4 6
7 9 11
6 9 13
7 7 7
3 5 6
Output
17
Input
10 7 1
3 4 15
8 9 8
5 6 8
9 10 6
1 4 2
1 4 10
8 10 13
Output
2
Input
10 1 9
5 10 14
Output
-1
----------------------------------------------------------------------------------------------------
E. Ilya and Two Numbers
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

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