P12274 [AOJ] Pipe Fitter and the Fierce Dogs
普及
题目描述

Example

Input

5 5 4
6
3 2
4 2
5 2
1 4
3 4
5 4

Output

6

输入格式

见题面

输出格式

见题面

样例输入
5 5 4 6 3 2 4 2 5 2 1 4 3 4 5 4
样例输出
6