using System; using System.IO; using System.Linq; using System.Collections; using System.Collections.Generic; using System.Numerics; using System.Text; using System.Text.RegularExpressions; using System.Threading.Tasks; using static System.Math; using Debug = System.Diagnostics.Debug; using System.Runtime.InteropServices; using System.Runtime.CompilerServices; class Ph { static void Main() { Console.WriteLine((16 - Console.ReadLine().Replace("NONE","").Split(',').Count()) * (16 - Console.ReadLine().Split(',').Count()) * (16 - Console.ReadLine().Split(',').Count())); } } class UnionFind { public int Size { get; private set; } List parent; List sizes; public UnionFind(int count) { Size = 0; parent = new List(count); sizes = new List(count); ExtendSize(count); } public bool Unite(int x, int y) { int xp = Find(x); int yp = Find(y); if (yp == xp) return false; if (sizes[xp] < sizes[yp]) { var tmp = xp; xp = yp; yp = tmp; } parent[yp] = xp; sizes[xp] += sizes[yp]; return true; } public IEnumerable AllParents => parent.Where(x => x == parent[x]); public int GetSize(int x) => sizes[x]; public int Find(int x) => parent[x] == parent[parent[x]] ? parent[x] : parent[x] = Find(parent[x]); public void ExtendSize(int treeSize) { if (treeSize <= Size) return; parent.Capacity = treeSize; sizes.Capacity = treeSize; while (Size < treeSize) { parent.Add(Size); sizes.Add(1); Size++; } } }