VK Cup 2012 Finals, Practice Session


A. Multicolored Marbles
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
3
Output
6
Input
4
Output
11
----------------------------------------------------------------------------------------------------
B. Pixels
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
1 1 1
Output
1
Input
3 1 0
Output
3
----------------------------------------------------------------------------------------------------
C. Trails and Glades
time limit per test: 4 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

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