Codeforces Round 230 (Div. 2)


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

Examples
Input
nniinneetteeeenn
Output
2
Input
nneteenabcnneteenabcnneteenabcnneteenabcnneteenabcii
Output
2
Input
nineteenineteen
Output
2
----------------------------------------------------------------------------------------------------
B. Three matrices
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
2
1 4
3 2
Output
1.00000000 3.50000000
3.50000000 2.00000000
0.00000000 0.50000000
-0.50000000 0.00000000
Input
3
1 2 3
4 5 6
7 8 9
Output
1.00000000 3.00000000 5.00000000
3.00000000 5.00000000 7.00000000
5.00000000 7.00000000 9.00000000
0.00000000 -1.00000000 -2.00000000
1.00000000 0.00000000 -1.00000000
2.00000000 1.00000000 0.00000000
----------------------------------------------------------------------------------------------------
C. Blocked Points
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
1
Output
4
Input
2
Output
8
Input
3
Output
16
----------------------------------------------------------------------------------------------------
D. Tower of Hanoi
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
0 1 1
1 0 1
1 1 0
3
Output
7
Input
0 2 2
1 0 100
1 2 0
3
Output
19
Input
0 2 1
1 0 100
1 2 0
5
Output
87
----------------------------------------------------------------------------------------------------
E. Yet Another Number Sequence
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
1 1
Output
1
Input
4 1
Output
34
Input
5 2
Output
316
Input
7 4
Output
73825
----------------------------------------------------------------------------------------------------
