Our satellite has just discovered an alien civilization on a remote planet. We have already obtained a low-resolution photo of a square area of the planet. The photo shows many signs of intelligent life. Our experts have identified points of interest in the photo. The points are numbered from to . We now want to take high-resolution photos that contain all of those points.

Internally, the satellite has divided the area of the low-resolution photo into an by grid of unit square cells. Both rows and columns of the grid are consecutively numbered from to (from the top and left, respectively). We use to denote the cell in row and column . The point number is located in the cell . Each cell may contain an arbitrary number of these points.

Our satellite is on a stable orbit that passes directly over the *main* diagonal of the grid. The main diagonal is the line segment that connects the top left and the bottom right corner of the grid. The satellite can take a high-resolution photo of any area that satisfies the following constraints:

- the shape of the area is a square,
- two opposite corners of the square both lie on the main diagonal of the grid,
- each cell of the grid is either completely inside or completely outside the photographed area.

The satellite is able to take at most high-resolution photos.

Once the satellite is done taking photos, it will transmit the high-resolution photo of each photographed cell to our home base (regardless of whether that cell contains some points of interest). The data for each photographed cell will only be transmitted *once*, even if the cell was photographed several times.

Thus, we have to choose at most square areas that will be photographed, assuring that:

- each cell containing at least one point of interest is photographed at least once, and
- the number of cells that are photographed at least once is minimized.

Your task is to find the smallest possible total number of photographed cells.

#### Implementation details

You should implement the following function (method):

```
long long take_photos(int n, int m, int k, int r[], int c[])
```

`n`

: the number of points of interest,`m`

: the number of rows (and also columns) in the grid,`k`

: the maximum number of photos the satellite can take,`r`

and`c`

: two arrays of length describing the coordinates of the grid cells that contain points of interest. For , the point of interest is located in the cell ,- the function should return the smallest possible total number of cells that are photographed at least once (given that the photos must cover all points of interest).

#### Examples

##### Example 1

```
take_photos(5, 7, 2, {0, 4, 4, 4, 4}, {3, 4, 6, 5, 6})
```

In this example we have a grid with points of interest. The points of interest are located in four different cells: , , and . You may take at most high-resolution photos.

One way to capture all five points of interest is to take two photos: a photo of the square containing the cells and , and a photo of the square containing the cells and . If the satellite takes these two photos, it will transmit the data about cells. This amount is not optimal.

The optimal solution uses one photo to capture the square containing cells and and another photo to capture the square containing cells and . This results in only photographed cells, which is optimal, so `take_photos`

should return .

Note that it is sufficient to photograph the cell once, even though it contains two points of interest.

This example is shown in the figures below. The leftmost figure shows the grid that corresponds to this example. The middle figure shows the suboptimal solution in which cells were photographed. The rightmost figure shows the optimal solution.

##### Example 2

```
take_photos(2, 6, 2, {1, 4}, {4, 1})
```

Here we have points of interest located symmetrically: in the cells and . Any valid photo that contains one of them contains the other one as well. Therefore, it is sufficient to use a single photo.

The figures below show this example and its optimal solution. In this solution the satellite captures a single photo of cells.

#### Subtasks

For all subtasks, .

- (4 points) , , ,
- (12 points) , , for all such that , ,
- (9 points) , ,
- (16 points) , ,
- (19 points) , , ,
- (40 points) , .

## Comments