Codeforces Round 152 (Div. 1)


A. Robo-Footballer
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
4 10 13 10 3 1
Output
4.3750000000
Input
1 4 6 2 2 1
Output
-1
Input
3 10 15 17 9 2
Output
11.3333333333
----------------------------------------------------------------------------------------------------
B. Sweets for Everyone!
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
6 6
HSHSHS
Output
1
Input
14 100
...HHHSSS...SH
Output
0
Input
23 50
HHSS.......SSHHHHHHHHHH
Output
8
----------------------------------------------------------------------------------------------------
C. Piglet's Birthday
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
3
2 2 3
5
1 2 1
2 1 2
1 2 2
3 1 1
3 2 2
Output
0.000000000000
0.333333333333
1.000000000000
1.000000000000
2.000000000000
----------------------------------------------------------------------------------------------------
D. Donkey and Stars
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
15
1/3 2/1
3 1
6 2
4 2
2 5
4 5
6 6
3 4
1 6
2 1
7 4
9 3
5 3
1 3
15 5
12 4
Output
4
----------------------------------------------------------------------------------------------------
E. Endless Matrix
time limit per test: 3 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
5
1 1 1 1
2 2 3 3
2 3 5 6
100 87 288 2002
4 2 5 4
Output
1
24
300
...5679392764
111
----------------------------------------------------------------------------------------------------
