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