Codeforces Round 384 (Div. 2)


A. Vladik and flights
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
4 1 4
1010
Output
1
Input
5 5 2
10110
Output
0
----------------------------------------------------------------------------------------------------
B. Chloe and the sequence
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
3 2
Output
2
Input
4 8
Output
4
----------------------------------------------------------------------------------------------------
C. Vladik and fractions
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
3
Output
2 7 42
Input
7
Output
7 8 56
----------------------------------------------------------------------------------------------------
D. Chloe and pleasant prizes
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
8
0 5 -1 4 3 2 6 5
1 2
2 4
2 5
1 3
3 6
6 7
6 8
Output
25
Input
4
1 -5 1 1
1 2
1 4
2 3
Output
2
Input
1
-1
Output
Impossible
----------------------------------------------------------------------------------------------------
E. Vladik and cards
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
3
1 1 1
Output
1
Input
8
8 7 6 5 4 3 2 1
Output
8
Input
24
1 8 1 2 8 2 3 8 3 4 8 4 5 8 5 6 8 6 7 8 7 8 8 8
Output
17
----------------------------------------------------------------------------------------------------
