Testing Round 12


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

Examples
Input
1 1 10
Output
10
Input
2 -4 4
Output
5
----------------------------------------------------------------------------------------------------
B. Restaurant
time limit per test: 4 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

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

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