import sys input = lambda: sys.stdin.readline().rstrip() # ----------------------- # n = int(input()) A = list(map(int, input().split())) B = list(map(int, input().split())) C = list(map(int, input().split())) a, b, c = 0, 0, 0 for i in range(n): if A[i] % 3: a += 1 if B[i] % 3: b += 1 if C[i] % 3: c += 1 print(a * b * c)