#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#define SIZE 100
#define WIDTH 10
void initPaper(int (*whitePaper)[SIZE]);
void fillBlackPaper(int (*whitePaper)[SIZE], int x, int y);
int countBlackPaper(int (*whitePaper)[SIZE]);
int main()
{
/* Declare Variables */
int whitePaper[SIZE][SIZE];
int numColorPaper;
int xColorPaper;
int yColorPaper;
int i;
int area;
/* Initialize Variables */
initPaper(whitePaper);
/* Get Input */
scanf("%d", &numColorPaper);
/* Get Color Paper */
for (i = numColorPaper; i > 0; i--)
{
scanf("%d", &xColorPaper);
scanf("%d", &yColorPaper);
xColorPaper--;
yColorPaper--;
fillBlackPaper(whitePaper, xColorPaper, yColorPaper);
}
area = countBlackPaper(whitePaper);
printf("%d\n", area);
}
void initPaper(int (*whitePaper)[SIZE])
{
/* Declare Variables */
int row;
int col;
/* Fill White Paper */
for (row = SIZE-1; row != -1; row--)
{
for (col = SIZE-1; col != -1; col--)
{
whitePaper[row][col] = 0;
}
}
}
void fillBlackPaper(int (*whitePaper)[SIZE], int x, int y)
{
/* Declare Variables */
int row;
int col;
/* Fille Black Paper */
for (col = x; col < x + WIDTH; col++)
{
for(row = ((SIZE-1) - y); (row != ((SIZE - 1) - y - WIDTH )); row--)
{
if (
(row < 0) |
(row >= SIZE) |
(col < 0) |
(col >= SIZE)
)
{
break;
}
whitePaper[row][col] = 1;
}
}
}
int countBlackPaper(int (*whitePaper)[SIZE])
{
/* Declare Variables */
int cnt;
int row;
int col;
/* Initialize Variables */
cnt = 0;
for (row = 0; row < SIZE; row++)
{
for (col = 0; col < SIZE; col++)
{
if (whitePaper[row][col] == 1)
{
cnt++;
}
}
}
return cnt;
}