#!/mnt/c/Users/moiki/bash/env/bin/python # N,M = map(int, input().split()) r = input() g = input() b = input() lst_color = [r,g,b] lst_color = [ 0 if a == "NONE" else len(a.split(",")) for a in lst_color] lst_color = [ 16 - e for e in lst_color] print( lst_color[0] ** 2 * lst_color[1] ** 2 * lst_color[2] ** 2)