Codeforces Round 132 (Div. 2)


A. Bicycle Chain
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
2
4 5
3
12 13 15
Output
2
Input
4
1 2 3 4
5
10 11 12 13 14
Output
1
----------------------------------------------------------------------------------------------------
B. Olympic Medal
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
3 1 2 3
1 2
3 3 2 1
1 2
Output
2.683281573000
Input
4 2 3 6 4
2 1 2
3 10 6 8
2 1
Output
2.267786838055
----------------------------------------------------------------------------------------------------
C. Crosses
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
2 2 1
Output
4
Input
3 4 5
Output
4
----------------------------------------------------------------------------------------------------
D. Hot Days
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
2 10
30 35 1 100
20 35 10 10
Output
120
Input
3 100
10 30 1000 1
5 10 1000 3
10 40 1000 100000
Output
200065
----------------------------------------------------------------------------------------------------
E. Periodical Numbers
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
1 10
Output
3
Input
25 38
Output
2
----------------------------------------------------------------------------------------------------
