ll n,m,k,a[1d6],b[1d6],M=1d4,X,Y;{rd(n,m,k,a(n),b(m));Mint C[M],D[M],A[M],B[M],R;C[0]=D[0]=1;rep(i,n)C[X^=a[i]]+=1;rep(i,m)D[Y^=b[i]]+=1;rep(i,M){rep(j,i){A[i^j]+=C[i]*C[j];B[i^j]+=D[i]*D[j];}A[0]+=C[i]*(C[i]-1)/2;B[0]+=D[i]*(D[i]-1)/2;}rep(i,M)R+=A[i]*B[k^i];wt(R);}