Codeforces Round 259 (Div. 1)


A. Little Pony and Expected Maximum
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
6 1
Output
3.500000000000
Input
6 3
Output
4.958333333333
Input
2 2
Output
1.750000000000
----------------------------------------------------------------------------------------------------
B. Little Pony and Harmony Chest
time limit per test: 4 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
5
1 1 1 1 1
Output
1 1 1 1 1 
Input
5
1 6 4 2 8
Output
1 5 3 1 8 
----------------------------------------------------------------------------------------------------
C. Little Pony and Summer Sun Celebration
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
3 2
1 2
2 3
1 1 1
Output
3
1 2 3
Input
5 7
1 2
1 3
1 4
1 5
3 4
3 5
4 5
0 1 0 1 0
Output
10
2 1 3 4 5 4 5 4 3 1 
Input
2 0
0 0
Output
0
----------------------------------------------------------------------------------------------------
D. Little Pony and Elements of Harmony
time limit per test: 6 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
2 2 10000
4 1 2 3
0 1 0
Output
14
6
6
14
----------------------------------------------------------------------------------------------------
E. Little Pony and Lord Tirek
time limit per test: 3 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
5
0 10 1
0 12 1
0 20 1
0 12 1
0 10 1
2
5 1 5
19 1 5
Output
25
58
----------------------------------------------------------------------------------------------------
