#include using namespace std; #define int long long #define REP(i,m,n) for(int i=(m);i<(n);i++) #define rep(i,n) REP(i,0,n) #define pb push_back #define all(a) a.begin(),a.end() #define rall(c) (c).rbegin(),(c).rend() #define mp make_pair #define endl '\n' #define vec vector #define mat vector > #define fi first #define se second typedef long long ll; typedef unsigned long long ull; typedef pair pll; typedef long double ld; typedef complex comp; const ll inf=1e9+7; const ll mod=1e9+7; const int MAX=200010; ll rui(ll a,ll b){ ll res=1; ll x=a%mod; while(b){ if(b&1)res=res*x%mod; b/=2; x=x*x%mod; } return res; } signed main(){ ll n,m,x;cin>>n>>m>>x; vectora(n),b(m); rep(i,n)cin>>a[i]; rep(i,m)cin>>b[i]; if(n==1){ ll B=0; rep(i,m){ B^=b[i]; } if(a[0]!=B){ cout<<0<