C2. Finding Treasure (Hard)
time limit per test
2 seconds
memory limit per test
1024 megabytes
input
standard input
output
standard output
Examples
Input
3 7 5
Output
12
Input
1 10000 10000
Output
0
Input
100 100 1
Output
99
Input
6 1 1
Output
3