public static void Main()
const int numberOfLines = 8;
string[,] matrix = new string[8, 8];
for (int row = 0; row < numberOfLines; row++)
int input = int.Parse(Console.ReadLine());
for (int col = numberOfLines - 1; col >= 0; col--)
int digit = input & (1 << shift);
matrix[row, col] = digit.ToString();
for (int i = 0; i < numberOfLines - 1; i++)
for (int row = numberOfLines - 2; row >= 0; row--)
for (int col = 0; col < numberOfLines; col++)
if (matrix[row, col] == "1")
if (matrix[row + 1, col] == "0")
matrix[row + 1, col] = "1";
for (int row = 0; row < numberOfLines; row++)
for (int col = 0; col < numberOfLines; col++)
result += matrix[row, col];
result = Convert.ToInt32(result, 2).ToString();
Console.WriteLine(result);