#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1e9 + 7;
const long long maxn = 5e5 + 100;
long long n, m, k, res, Color;
long long u[maxn];
long long v[maxn];
long long label[maxn];
long long fa[maxn];
map<long long, vector<long long> > edgs;
long long val[maxn];
long long bas[maxn];
long long cnt;
vector<long long> temp(0);
long long find(long long x) { return fa[x] == x ? x : fa[x] = find(fa[x]); }
void init() {
  bas[0] = 1;
  for (long long i = 1; i < maxn; ++i) {
    bas[i] = 2LL * bas[i - 1] % MOD;
  }
  for (long long i = 1; i <= n; ++i) {
    fa[i] = i;
  }
}
inline void addEdge(int i) { edgs[val[u[i]] ^ val[v[i]]].push_back(i); }
void input() {
  scanf("%lld%lld%lld", &n, &m, &k);
  for (int i = 1; i <= n; ++i) {
    scanf("%lld", val + i);
  }
  for (int i = 1; i <= m; ++i) {
    scanf("%lld%lld", u + i, v + i);
    addEdge(i);
  }
}
void find_edge(vector<long long> &E) {
  for (long long i = 0; i < E.size(); ++i) {
    long long x = u[E[i]];
    long long y = v[E[i]];
    long long fx = find(x);
    long long fy = find(y);
    if (fx != fy) {
      cnt--;
      fa[fx] = fy;
    }
    if (label[x] != Color) {
      temp.push_back(x), label[x] = Color;
    }
    if (label[y] != Color) {
      temp.push_back(y), label[y] = Color;
    }
  }
}
void work(vector<long long> &E) {
  ++Color;
  temp.clear();
  cnt = n;
  find_edge(E);
  res = (res + bas[cnt]) % MOD;
  for (long long i = 0; i < temp.size(); ++i) {
    fa[temp[i]] = temp[i];
  }
}
void solve() {
  for (auto it : edgs) {
    work(it.second);
  }
  long long p = ((1LL << k) - (long long)edgs.size()) % MOD;
  res = (res + p * bas[n] % MOD) % MOD;
  cout << res << endl;
}
int main() {
  input();
  init();
  solve();
  return 0;
}
