Codeforces Beta Round 62


A. Irrational problem
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
2 7 1 8 2 8
Output
0
Input
20 30 40 50 0 100
Output
20
Input
31 41 59 26 17 43
Output
9
----------------------------------------------------------------------------------------------------
B. Energy exchange
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
3 50
4 2 1
Output
2.000000000
Input
2 90
1 11
Output
1.909090909
----------------------------------------------------------------------------------------------------
C. Synchrophasotron
time limit per test: 3 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
2
1 2 1 2 3
Output
1 4
Input
3
1 2 1 2 3
1 3 0 0 0
2 3 3 4 5
Output
-1 -1
Input
4
1 2 0 2 1
2 3 0 2 1
1 3 0 2 6
1 4 0 0 1
2 4 0 0 0
3 4 2 3 0
Output
2 15
Input
3
1 2 0 2 1
1 3 1 2 1
2 3 1 2 1
Output
2 6
----------------------------------------------------------------------------------------------------
D. Half-decay tree
time limit per test: 3 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
1 4
add 1 3
add 2 10
add 3 11
decay
Output
13.50000000
----------------------------------------------------------------------------------------------------
E. Contact
time limit per test: 3 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
0 0 1 0 1 2
0 0 0 2 2 2
0 0 3 0 1 2
0 0 3 0 2 2
Output
4
Input
0 0 0 1 1 1
0 0 0 2 2 2
0 0 0 5 5 5
0 0 0 17 17 17
Output
9
----------------------------------------------------------------------------------------------------
