Codeforces Round 549 (Div. 1)


A. The Beatles
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
2 3
1 1
Output
1 6
Input
3 2
0 0
Output
1 3
Input
1 10
5 3
Output
5 5
----------------------------------------------------------------------------------------------------
B. Lynyrd Skynyrd
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
3 6 3
2 1 3
1 2 3 1 2 3
1 5
2 6
3 5
Output
110
Input
2 4 3
2 1
1 1 2 2
1 2
2 3
3 4
Output
010
----------------------------------------------------------------------------------------------------
C. U2
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
3
-1 0
0 2
1 0
Output
2
Input
5
1 0
1 -1
0 -1
-1 0
-1 -1
Output
1
----------------------------------------------------------------------------------------------------
D. Foreigner
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
4021
Output
6
Input
110
Output
3
----------------------------------------------------------------------------------------------------
E. Pink Floyd
time limit per test: 4 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
4 2
1 2
3 4
0
1
1
Output
? 1 3
? 4 2
? 3 2
! 3
----------------------------------------------------------------------------------------------------
