Codeforces Round 102 (Div. 1)


A. Help Farmer
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
4
Output
28 41
Input
7
Output
47 65
Input
12
Output
48 105
----------------------------------------------------------------------------------------------------
B. Help General
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
2 4
Output
4
Input
3 4
Output
6
----------------------------------------------------------------------------------------------------
C. Help Caretaker
time limit per test: 3 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
3 3
Output
1
AAA
.A.
.A.
Input
5 6
Output
4
A..C..
AAAC..
ABCCCD
.B.DDD
BBB..D
Input
2 2
Output
0
..
..
----------------------------------------------------------------------------------------------------
D. Help Shrek and Donkey 2
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
2 3 1
R-G
RG-
Output
First
Input
3 3 2
G-R
R-G
G-R
Output
Second
Input
2 3 1
-R-
-G-
Output
Draw
Input
2 5 2
-G-R-
-R-G-
Output
First
----------------------------------------------------------------------------------------------------
E. Help Greg the Dwarf 2
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
2 2
1.0 0.0 0.0
-1.0 0.0 0.0
Output
2.000000000
Input
2 2
1.0 0.0 0.0
1.0 0.0 1.0
Output
2.414213562
Input
2 2
1.0 0.0 1.0
-1.0 0.0 1.0
Output
2.534324263
Input
2 2
1.0 0.0 0.0
0.0 1.0 1.0
Output
3.254470198
----------------------------------------------------------------------------------------------------
