F. Exam
time limit per test
2 seconds
memory limit per test
1024 megabytes
input
standard input
output
standard output
Examples
Input
3 3 3
1 2 3
1 1 1
Output
0
Input
3 3 4
1 2 3
1 1 1
Output
-1
Input
3 0 3
1 2 1
4 3 1
Output
4