#include #if __has_include() #include using namespace atcoder; #endif #define rep(i, n) for (int i = 0; i < (n); ++i) using namespace std; using ll = long long; using mint = modint1000000007; int main() { int n, m, x; cin >> n >> m >> x; vector a(n), b(m); rep(i, n) cin >> a[i]; rep(i, m) cin >> b[i]; int as = 0; rep(i, n) as ^= a[i]; int bs = 0; rep(i, m) bs ^= b[i]; if (as != bs) { puts("0"); return 0; } mint ans = mint(1ll<