Codeforces Round 339 (Div. 1)


A. Peter and Snow Blower
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
3 0 0
0 1
-1 2
1 2
Output
12.566370614359172464
Input
4 1 -1
0 0
1 2
2 0
1 1
Output
21.991148575128551812
----------------------------------------------------------------------------------------------------
B. Skills
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
3 5 10 1 5
1 3 1
Output
12
2 5 2 
Input
3 5 10 1 339
1 3 1
Output
35
5 5 5 
----------------------------------------------------------------------------------------------------
C. Necklace
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
3
4 2 1
Output
1
abacaba
Input
1
4
Output
4
aaaa
Input
2
1 1
Output
0
ab
----------------------------------------------------------------------------------------------------
D. Kingdom and its Cities
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
4
1 3
2 3
4 3
4
2 1 2
3 2 3 4
3 1 2 4
4 1 2 3 4
Output
1
-1
1
-1
Input
7
1 2
2 3
3 4
1 5
5 6
5 7
1
4 2 4 6 7
Output
2
----------------------------------------------------------------------------------------------------
E. Puzzle Lover
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
code
edoc
code
Output
4
Input
aaa
aaa
aa
Output
14
----------------------------------------------------------------------------------------------------
