Codeforces Round 421 (Div. 2)


A. Mister B and Book Reading
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
5 5 10 5 4
Output
1
Input
12 4 12 4 1
Output
3
Input
15 1 100 0 0
Output
15
----------------------------------------------------------------------------------------------------
B. Mister B and Angle in Polygon
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
3 15
Output
1 2 3
Input
4 67
Output
2 1 3
Input
4 68
Output
4 1 2
----------------------------------------------------------------------------------------------------
C. Mister B and Boring Game
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
1 1 1 8
Output
2
Input
4 2 2 6
Output
3
Input
3 7 4 6
Output
1
----------------------------------------------------------------------------------------------------
D. Mister B and PR Shifts
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
3
1 2 3
Output
0 0
Input
3
2 3 1
Output
0 1
Input
3
3 2 1
Output
2 1
----------------------------------------------------------------------------------------------------
E. Mister B and Beacons on Field
time limit per test: 5 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
3
2 1 1
2 1 1
1 1 3
1 5 1
2 2 1
1 1 2
10 6 18
2 103 2
13 1 13
Output
4
7
171
----------------------------------------------------------------------------------------------------
