Do you know the company Just Odd Inventions? The business of this company is to create "just odd inventions." Here, we will call it the JOI company.
The JOI company has $N$ employees, numbered from 1 to $N$. All employees work from time 0 to $M$. At time 0 and time $M$, all employees must be inside the company.
Today, by chance, every employee goes out exactly once. Employee $i$ ($1 \le i \le N$) leaves the company at time $S_i$ and returns to the company at time $T_i$. No two or more employees enter or leave the company at the same time.
There is one large door at the entrance of the JOI company, and employees can only enter or leave the company through this door. The door has a lock, and the lock is either open or closed. The lock can be opened or closed freely from inside the company, but from outside the company, only those with a spare key can open or close the lock. At time 0, the door lock is closed.
Every employee must be able to enter the company when they return. That is, for every $i$ ($1 \le i \le N$), either employee $i$ must have a spare key, or the door lock must be open at time $T_i$. When an employee returns to the company, and when an employee with a spare key leaves the company, they may choose whether or not to close the lock. An employee without a spare key cannot close the lock when leaving the company.
The president of the JOI company decided to give spare keys to $K$ of the $N$ employees. To avoid losing spare keys, employees cannot pass spare keys to each other. Also, because the president of the JOI company values work efficiency, employees cannot open or close the door lock except when they themselves are entering or leaving the company.
For security reasons, the president wants to maximize the total time the door lock is closed during the working time $M$.
Input
Read the following data from standard input:
- The first line contains integers $N, M, K$ separated by spaces. This indicates that there are $N$ employees at the JOI company, all work from time 0 to time $M$, and $K$ out of the $N$ employees are given spare keys.
- The $i$-th line of the following $N$ lines ($1 \le i \le N$) contains integers $S_i, T_i$ separated by spaces. This indicates that employee $i$ leaves the company at time $S_i$ and returns to the company at time $T_i$.
Output
Output a single integer representing the maximum total time the door lock is closed during the working time $M$, given optimal management of opening and closing the door lock.
Constraints
All input data satisfy the following conditions:
- $1 \le N \le 2000$.
- $1 \le M \le 1\,000\,000\,000$.
- $1 \le K < N$.
- $0 < S_i < T_i < M$ ($1 \le i \le N$).
- For any $i, j$ ($1 \le i \le N, 1 \le j \le N, i \neq j$), $S_i \neq S_j, S_i \neq T_j, T_i \neq T_j$.
Subtasks
Subtask 1 [10 points]
- $N \le 20$ is satisfied.
- $M \le 1\,000\,000$ is satisfied.
Subtask 2 [90 points]
- No additional constraints.
Examples
Input 1
4 20 2 3 11 5 15 6 10 12 18
Output 1
13
Note 1
In this example, there are 4 employees at the JOI company, and 2 of them are given spare keys. If we give spare keys to employee 2 and employee 4, and act as follows, the total time the door lock is closed is 13:
- At time 0, the door lock is closed.
- At time 3, employee 1 leaves the company. Since employee 1 does not have a spare key, the door lock cannot be closed.
- At time 5, employee 2 leaves the company and closes the door lock.
- At time 6, employee 3 leaves the company. Since employee 3 does not have a spare key, the door lock cannot be closed.
- At time 10, employee 3 returns to the company. The door lock is left open.
- At time 11, employee 1 returns to the company and closes the door lock.
- At time 12, employee 4 leaves the company and closes the door lock.
- At time 15, employee 2 returns to the company and closes the door lock.
- At time 18, employee 4 returns to the company and closes the door lock.
- Until time 20, the door lock remains closed.
Since there is no way for the total time the door lock is closed to exceed 13, we output 13.
Input 2
20 100000 8 29930 89724 56133 70462 28063 78568 32483 64351 9410 20176 55809 62944 32450 85190 73536 73966 20452 78868 45458 63484 8286 47425 76018 81622 16736 49308 85383 94641 25100 40002 22158 22821 23508 41781 61709 98882 58110 78431 28448 89247
Output 2
72454