#include <bits/stdc++.h>
using namespace std;
const int N = 500510;
const int mod = (int)1e9 + 7;
long long c[N];
int p[N], pop_back[N], sz[N];
set<int> s;
map<long long, vector<pair<int, int>>> mp;
int mul(int x, int y) { return (x * 1ll * y) % mod; }
int add(int x, int y) {
  x = x + y;
  if (x < 0) x += mod;
  return x % mod;
}
int root(int x) {
  while (x != p[x]) x = p[p[x]];
  return x;
}
void unite(int x, int y) {
  if (sz[y] < sz[x]) swap(x, y);
  sz[y] += sz[x];
  p[x] = y;
}
void refresh(vector<pair<int, int>> &u) {
  for (pair<int, int> z : u) {
    p[z.first] = z.first;
    p[z.second] = z.second;
    sz[z.first] = sz[z.second] = 1;
  }
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  pop_back[0] = 1;
  for (int i = 1; i < N; i++) pop_back[i] = mul(pop_back[i - 1], 2);
  int n, m, k;
  cin >> n >> m >> k;
  for (int i = 1; i <= n; i++) {
    cin >> c[i];
    p[i] = i;
    sz[i] = 1;
  }
  int x, y;
  while (m--) {
    cin >> x >> y;
    mp[c[x] ^ c[y]].push_back({x, y});
  }
  int ans = mul(pop_back[n], add(pop_back[k], -(int)mp.size()));
  for (auto z : mp) {
    s.clear();
    for (pair<int, int> xy : z.second) {
      x = root(xy.first);
      y = root(xy.second);
      if (x != y) unite(x, y);
    }
    for (pair<int, int> xy : z.second) s.insert(root(xy.first));
    int cnt = n;
    for (int j : s) cnt -= (sz[j] - 1);
    refresh(z.second);
    ans = add(ans, pop_back[cnt]);
  }
  cout << ans;
  return 0;
}
