#C5152. Count Available Cells for Presents

    ID: 48770 Type: Default 1000ms 256MiB

Count Available Cells for Presents

Count Available Cells for Presents

You are given a grid with R rows and C columns. In this grid, some of the cells are blocked and cannot be used for placing presents. Your task is to determine the number of cells available for placing presents.

The total number of cells is given by \(R \times C\), and if there are \(N_{blocked}\) blocked cells, then the number of available cells is:

[ \text{available} = R \times C - N_{blocked} ]

Note that the positions of the blocked cells are provided as coordinates. The cells are uniquely identified by their row and column numbers.

inputFormat

The input is given via stdin in the following format:

R C
K
r1 c1
r2 c2
... 
rK cK

Where:

  • R and C are integers representing the number of rows and columns respectively.
  • K is an integer representing the number of blocked cells.
  • Each of the next K lines contains two integers r and c indicating the row and column of a blocked cell.

outputFormat

Output a single integer to stdout representing the number of available cells for placing presents.

## sample
5 5
0
25