Codeforces Round 102 (Div. 2)


A. Help Vasilisa the Wise 2
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
3 7
4 6
5 5
Output
1 2
3 4
Input
11 10
13 8
5 16
Output
4 7
9 1
Input
1 2
3 4
5 6
Output
-1
Input
10 10
10 10
10 10
Output
-1
----------------------------------------------------------------------------------------------------
B. Help Kingdom of Far Far Away 2
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
2012
Output
$2,012.00
Input
0.000
Output
$0.00
Input
-0.00987654321
Output
($0.00)
Input
-12345678.9
Output
($12,345,678.90)
----------------------------------------------------------------------------------------------------
C. 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
----------------------------------------------------------------------------------------------------
D. 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
----------------------------------------------------------------------------------------------------
E. 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
..
..
----------------------------------------------------------------------------------------------------
