import math import sys from operator import itemgetter input = sys.stdin.readline # a = int(input().rstrip()) # a, b = map(int, input().rstrip().split()) # D = list(map(int, input().rstrip().split())) # H = [int(input().rstrip()) for _ in range(L)] # DD = [[0 for j in range(100)] for i in range(200)] # if __name__ == '__main__': r_len, g_len, b_len = [0, 0, 0] def count_len(str): if (str == "NONE"): return 0 else: return ((len(str)+1) // 2) if __name__ == '__main__': r = str(input().rstrip()) g = str(input().rstrip()) b = str(input().rstrip()) r_len = 16 - count_len(r) g_len = 16 - count_len(g) b_len = 16 - count_len(b) print(r_len**2 * g_len**2 * b_len**2)