eolymp
bolt
Try our new interface for solving problems
Problems

Почти максимум

Почти максимум

Почти максимум

Time limit 1 second
Memory limit 64 MiB
Input example #1
2 3 0			
1 1 1			
1 0 1
Output example #1
4
1
Input example #2
5 5 2    		
1 1 1 1 1		
1 0 1 1 1
1 1 0 1 1
1 1 1 0 1
1 1 1 1 1
Output example #2
9
54