Codeforces Round #FF (Div. 1)


A. DZY Loves Sequences
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
6
7 2 3 1 5 6
Output
5
----------------------------------------------------------------------------------------------------
B. DZY Loves Modification
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
2 2 2 2
1 3
2 4
Output
11
Input
2 2 5 2
1 3
2 4
Output
11
----------------------------------------------------------------------------------------------------
C. DZY Loves Fibonacci Numbers
time limit per test: 4 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
4 4
1 2 3 4
1 1 4
2 1 4
1 2 4
2 1 3
Output
17
12
----------------------------------------------------------------------------------------------------
D. DZY Loves Games
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
5 5 3
0 0 1 0 1
1 2
2 3
3 4
4 5
1 2
Output
0.25000000
Input
3 2 2
0 1 1
1 2
2 3
Output
-0.00000000
Input
2 1 3
0 1
1 2
Output
1.00000000
----------------------------------------------------------------------------------------------------
E. DZY Loves Bridges
time limit per test: 5 seconds
memory limit per test: 512 megabytes
input: standard input
output: standard output

Examples
Input
2 1 4
1 1 1 2
Output
1
Input
3 5 6
389094 705719 547193 653800 947499 17024
Output
556970
----------------------------------------------------------------------------------------------------
