#include <bits/stdc++.h>
using namespace std;
const long long mod = 1e9 + 7;
struct node {
  int x, y;
};
vector<node> G[1000000 + 10];
map<long long, int> mp;
int num, p[500000 + 5];
long long a[500000 + 5], po[500000 + 5];
int find(int x) {
  if (x == p[x])
    return x;
  else
    return p[x] = find(p[x]);
}
void unite(int x, int y) {
  x = find(x);
  y = find(y);
  if (x != y) p[x] = y;
}
int main() {
  ios::sync_with_stdio(false);
  po[0] = 1;
  for (int i = 1; i < 500000 + 5; i++) {
    po[i] = (po[i - 1] << 1) % mod;
    p[i] = i;
  }
  long long n, m, k;
  cin >> n >> m >> k;
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
  }
  for (int i = 1; i <= m; i++) {
    int x, y;
    cin >> x >> y;
    long long t = a[x] ^ a[y];
    if (!mp[t]) mp[t] = ++num;
    G[mp[t]].push_back(node{x, y});
  }
  long long ans = ((1LL << k) - num) % mod * po[n] % mod;
  for (int i = 1; i <= num; i++) {
    int s = n;
    for (int j = 0; j < G[i].size(); j++) {
      node& e = G[i][j];
      if (find(e.x) != find(e.y)) {
        s--;
        unite(e.x, e.y);
      }
    }
    ans = (ans + po[s]) % mod;
    for (int j = 0; j < G[i].size(); j++) {
      node& e = G[i][j];
      p[e.x] = e.x;
      p[e.y] = e.y;
    }
  }
  cout << ans;
  return 0;
}
