#include using namespace std; #include using namespace atcoder; using mint=modint1000000007; using ll=long long; using pp=pair; #define sr string #define vc vector #define fi first #define se second #define rep(i,n) for(int i=0;i<(int)n;i++) #define pb push_back #define all(v) v.begin(),v.end() #define pque priority_queue #define bpc(a) __builtin_popcount(a) int main(){ int n,m,k;cin>>n>>m>>k; vca(n),b(m); int t=1<<10; rep(i,n)cin>>a[i]; rep(i,m)cin>>b[i]; auto f=[&](vcv)->vc{ vcres(t,0); vcx(t,0); x[0]=1; int now=0; for(auto au:v){ now^=au; rep(i,t)res[i^now]+=x[i]; x[now]++; } return res; }; auto resa=f(a); auto resb=f(b); mint ans=0; rep(i,t)ans+=(mint)resa[i]*resb[i^k]; cout<