Codeforces Beta Round 53


A. Square Earth?
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
2 0 0 1 0
Output
1
Input
2 0 1 2 1
Output
4
Input
100 0 0 100 100
Output
200
----------------------------------------------------------------------------------------------------
B. Martian Architecture
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

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

Examples
Input
2
Output
4
Input
3
Output
17
----------------------------------------------------------------------------------------------------
D. Journey
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
2 2
..
.X
Output
0.888888888889
Input
3 3
...
.X.
...
Output
2.000000000000
----------------------------------------------------------------------------------------------------
E. Chess
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
1 0
Output
9
Input
2 7
-1 2
1 2
2 1
2 -1
1 -2
-1 -2
-2 -1
Output
9
----------------------------------------------------------------------------------------------------
