#include <stdio.h>

int field[15][15];

int main(void)
{
	int x, y;
	int size;
	int sum = 0, max = 0;
	
	while (scanf("%d %d %d", &x, &y, &size) != EOF){
		
		if (size > 0){
			field[y + 2][x + 2]++;
			field[y + 3][x + 2]++;
			field[y + 2][x + 3]++;
			field[y + 2][x + 1]++;
			field[y + 2][x + 2]++;
		}
		if (size > 1){
			field[y + 1][x + 1]++;
			field[y + 3][x + 3]++;
			field[y + 1][x + 3]++;
			field[y + 3][x + 1]++;
		}
		if (size > 2){
			field[y][x + 2]++;
			field[y + 4][x + 2]++;
			field[y + 2][x]++;
			field[y + 2][x + 4]++;
		}
	}
	
	for (int i = 0; i < 10; i++){
		for (int j = 0; j < 10; j++){
			if (field[i][j] == 0){
				sum++;
			}
			if (field[i][j] > max){
				max = field[i][j];
			}
		}
	}
	return (0);
}