#include using namespace std; using ll = long long; #define rep(i,m,n) for(int i=m; i> N; vector A(N), B(N), C(N); for(int &a : A) cin >> a; for(int &b : B) cin >> b; for(int &c : C) cin >> c; ll cntA = 0LL, cntB = 0LL, cntC = 0LL; rep(i, 0, N){ if(A[i] % 3 != 0) cntA++; if(B[i] % 3 != 0) cntB++; if(C[i] % 3 != 0) cntC++; } cout << cntA*cntB*cntC << endl; return 0; }