using System; using System.Linq; public class Program { const int RED_GREEN_BLUE = 3; public static void Main(string[] args) { var colors = new[] { "0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "A", "B", "C", "D", "E", "F" }; var patterns = 1; var remain = 0; var line = string.Empty; for (var i = 0; i < RED_GREEN_BLUE; i++) { line = Console.ReadLine(); remain = (line == "NONE") ? colors.Count() : colors.Except(line.Split(',').ToArray()).Count(); patterns *= remain * remain; } Console.WriteLine(patterns); } }