#include <bits/stdc++.h>
using namespace std;
const int N = 5e5 + 11;
const long long mod = 1e9 + 7;
int n, m, k;
long long a[N], ans;
int par[N], sz[N];
pair<long long, pair<int, int> > b[N];
vector<pair<int, int> > v;
vector<int> cur;
bool u[N];
int find_set(int v) {
  if (v == par[v]) return v;
  return par[v] = find_set(par[v]);
}
void union_sets(int a, int b) {
  a = find_set(a);
  b = find_set(b);
  if (a != b) {
    if (sz[a] < sz[b]) swap(a, b);
    par[b] = a;
    sz[a] += sz[b];
  }
}
long long binpow(int n) {
  long long a = 2, res = 1;
  while (n) {
    if (n % 2 == 0) {
      n /= 2;
      a = (a * a) % mod;
    } else {
      n--;
      res = (res * a) % mod;
    }
  }
  return res;
}
int main() {
  cin >> n >> m >> k;
  for (int i = 1; i <= n; i++) scanf("%I64d", &a[i]);
  for (int i = 1; i <= m; i++) {
    scanf("%d%d", &b[i].second.first, &b[i].second.second);
    b[i].first = a[b[i].second.first] ^ a[b[i].second.second];
  }
  sort(b + 1, b + m + 1);
  int l = 0;
  int uniq = 0, comp;
  for (int i = 1; i <= m; i++) {
    if (b[i].first == b[i + 1].first) continue;
    comp = 0;
    for (int j = l + 1; j <= i; j++) v.push_back(b[j].second);
    for (auto i : v) {
      par[i.first] = i.first;
      par[i.second] = i.second;
      sz[i.first] = sz[i.second] = 1;
    }
    for (auto i : v) {
      if (!u[i.first]) cur.push_back(i.first);
      if (!u[i.second]) cur.push_back(i.second);
      u[i.first] = u[i.second] = true;
    }
    for (auto i : v) union_sets(i.first, i.second);
    for (auto i : cur)
      if (find_set(i) == i) comp++;
    ans = (ans + binpow(n - (int)cur.size() + comp)) % mod;
    for (auto i : cur) {
      u[i] = false;
    }
    cur.clear();
    v.clear();
    l = i;
    uniq++;
  }
  long long p = ((1ll << k) - uniq) % mod;
  p = (p * binpow(n)) % mod;
  ans = (ans + p) % mod;
  cout << ans;
  return 0;
}
