import sequtils,strutils var R = stdin.readline.split(',') G = stdin.readline.split(',') B = stdin.readline.split(',') proc parse16(s : string):int = if s.isDigit: return s.parseInt else: return ord(s[0]) - ord('A') + 10 var Ri : seq[int] Gi : seq[int] Bi : seq[int] r,g,bl : int if R[0] == "NONE": Ri = @[] else: Ri = R.map(parse16) if G[0] == "NONE": Gi = @[] else: Gi = G.map(parse16) if B[0] == "NONE": Bi = @[] else: Bi = B.map(parse16) for a in 0..15: for b in 0..15: if not(a in Ri) and not(b in Ri): r += 1 if not(a in Gi) and not(b in Gi): g += 1 if not(a in Bi) and not(b in Bi): bl += 1 echo r * g * bl