using System; using System.Collections.Generic; using System.Linq; public class Program { 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 except = 0; string line; string[] lineStr; for (var i=0; i<3; i++) { line = Console.ReadLine(); if (line != "NONE") { lineStr = line.Split(','); except = colors.Except(lineStr.ToArray()).Count(); except = except * except; patterns *= except; } } Console.WriteLine(patterns == 0 ? 16777216 : patterns); } }