#include <bits/stdc++.h>
using namespace std;
long long val[500009];
vector<pair<int, int> > G[500009];
map<long long, int> mp;
int cnt = 1;
int parent[500009];
long long M = (long long)(1e9 + 7);
int root(int x) {
  if (x == parent[x]) {
    return x;
  }
  int y = parent[x];
  int z = root(y);
  parent[x] = z;
  return z;
}
long long power(long long x, long long y) {
  long long res = 1;
  while (y > 0) {
    if (y % 2 == 1) {
      res = (res * x) % M;
    }
    y /= 2;
    x = (x * x) % M;
  }
  return res;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int n, m, k;
  cin >> n >> m >> k;
  for (int i = 1; i <= n; i++) {
    cin >> val[i];
  }
  for (int i = 1; i <= m; i++) {
    int a, b;
    cin >> a >> b;
    long long x = val[a] ^ val[b];
    int y = mp[x];
    if (y == 0) {
      mp[x] = cnt;
      G[cnt].push_back(make_pair(a, b));
      cnt++;
    } else {
      G[y].push_back(make_pair(a, b));
    }
  }
  for (int i = 1; i <= n; i++) {
    parent[i] = i;
  }
  long long ans = 0;
  for (int i = 1; i < cnt; i++) {
    long long size = n;
    set<int> st;
    for (int j = 0; j < (int)G[i].size(); j++) {
      int a = G[i][j].first, b = G[i][j].second;
      st.insert(a);
      st.insert(b);
      int pa = root(a), pb = root(b);
      if (pa != pb) {
        size--;
        parent[pa] = pb;
      }
    }
    while (!st.empty()) {
      parent[*st.begin()] = *st.begin();
      st.erase(st.begin());
    }
    ans = (ans + power(2LL, size)) % M;
  }
  cnt--;
  ans = (ans + ((((1LL << k) - (long long)cnt) % M) * power(2LL, n)) % M) % M;
  cout << ans << endl;
}
