using System.Collections.Generic;
public static void Main()
const int numberOfLines = 16;
char[,] matrix = new char[16, 16];
List<string> outputs = new List<string>();
char redCenterCapacitor = 'R';
char blueCenterCapacitor = 'B';
for (int row = 0; row < numberOfLines; row++)
string line = Console.ReadLine();
for (int col = 0; col < line.Length; col++)
matrix[row, col] = digit;
for (int row = 1; row < numberOfLines - 1; row++)
for (int col = 1; col < numberOfLines - 1; col++)
if (matrix[row, col] == '0')
matrix[row - 1, col - 1] == '1' &&
matrix[row - 1, col] == '1' &&
matrix[row - 1, col + 1] == '1' &&
matrix[row, col - 1] == '1' &&
matrix[row, col + 1] == '1' &&
matrix[row + 1, col - 1] == '1' &&
matrix[row + 1, col] == '1' &&
matrix[row + 1, col + 1] == '1'
if (capacitorParts == 8 && col < numberOfLines / 2)
matrix[row, col] = redCenterCapacitor;
if (capacitorParts == 8 && col >= numberOfLines / 2)
matrix[row, col] = blueCenterCapacitor;
string command = Console.ReadLine();
int row = int.Parse(Console.ReadLine());
int col = int.Parse(Console.ReadLine());
if (matrix[row, col] == '1')
if (matrix[row, col] == '0' || matrix[row, col] == 'B' || matrix[row, col] == 'R')
if (command == "operate")
int row = int.Parse(Console.ReadLine());
int col = int.Parse(Console.ReadLine());
if (matrix[row, col] == '1')
outputs.Add((redCapacitors + blueCapacitors).ToString());
if (matrix[row, col] == 'R')
if (matrix[row, col] == 'B')
command = Console.ReadLine();
outputs.Add(blueCapacitors.ToString());
outputs.Add(redCapacitors.ToString());
outputs.Add(redCapacitors.ToString());
outputs.Add(blueCapacitors.ToString());
for (int i = 0; i < outputs.Count; i++)
Console.WriteLine(outputs[i]);