#include #define l long #define r(i,m,n) for(l i=m;iK(N) #define m 1000000007 #define n 1024 using namespace std;int main(){l N,M,K,s=0;cin>>N>>M>>K;V(P,l,N+1);V(Q,l,M+1);r(i,1,N+1)cin >> P[i];r(i,1,M+1)cin >> Q[i];r(i,1,N+1)P[i]^=P[i-1];r(i,1,M+1)Q[i]^=Q[i-1];V(A,l,n);V(B,l,n);V(C,l,n);V(D,l,n);r(i,0,N+1)A[P[i]]++;r(i,0,M+1)B[Q[i]]++;r(i,0,n)r(j,i,n){if(i==j){C[0]=(C[0]+A[i]*(A[i]-1)/2%m)%m;D[0]=(D[0]+B[i]*(B[i]-1)/2%m)%m;}else{C[i^j]=(C[i^j]+A[i]*A[j]%m)%m;D[i^j]=(D[i^j]+B[i]*B[j]%m)%m;}}r(i,0,n)s=(s+C[i]*D[K^i]%m)%m;cout<