Codeforces Round 274 (Div. 2)


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

Examples
Input
1
2
3
Output
9
Input
2
10
3
Output
60
----------------------------------------------------------------------------------------------------
B. Towers
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
3 2
5 8 5
Output
0 2
2 1
2 3
Input
3 4
2 2 4
Output
1 1
3 2
Input
5 3
8 3 2 6 3
Output
3 3
1 3
1 2
1 3
----------------------------------------------------------------------------------------------------
C. Exams
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
3
5 2
3 1
4 2
Output
2
Input
3
6 1
5 2
4 3
Output
6
----------------------------------------------------------------------------------------------------
D. Long Jumps
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
3 250 185 230
0 185 250
Output
1
230
Input
4 250 185 230
0 20 185 250
Output
0
Input
2 300 185 230
0 300
Output
2
185 230
----------------------------------------------------------------------------------------------------
E. Riding in a Lift
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
5 2 4 1
Output
2
Input
5 2 4 2
Output
2
Input
5 3 4 1
Output
0
----------------------------------------------------------------------------------------------------
