Codeforces Round 184 (Div. 2)


A. Strange Addition
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
4
100 10 1 0
Output
4
0 1 10 100 
Input
3
2 70 3
Output
2
2 70 
----------------------------------------------------------------------------------------------------
B. Continued Fractions
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
9 4
2
2 4
Output
YES
Input
9 4
3
2 3 1
Output
YES
Input
9 4
3
1 2 4
Output
NO
----------------------------------------------------------------------------------------------------
C. Ivan and Powers of Two
time limit per test: 0.5 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
4
0 1 1 1
Output
0
Input
1
3
Output
3
----------------------------------------------------------------------------------------------------
D. Olya and Graph
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
7 8 2
1 2
2 3
3 4
3 6
4 5
4 7
5 6
6 7
Output
2
Input
7 0 2
Output
12
Input
7 2 1
1 3
3 5
Output
0
----------------------------------------------------------------------------------------------------
E. Playing with String
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
abacaba
Output
First
2
Input
abcde
Output
Second
----------------------------------------------------------------------------------------------------
