#include <bits/stdc++.h>
using namespace std;
const int maxn = (int)(5e5 + 5);
const long long mod = (long long)(1e9 + 7);
long long a[maxn];
vector<pair<int, int> > ed[maxn];
vector<int> al[maxn];
unordered_map<int, int> vis;
int n, m, k;
inline int mul(long long a, long long b) { return (a * b) % mod; }
inline int add(int a, int b) {
  int ret = a + b;
  if (ret >= mod) {
    ret -= mod;
  }
  return ret;
}
inline int sub(int a, int b) {
  int ret = a - b;
  if (ret < 0) {
    ret += mod;
  }
  return ret;
}
inline int poww(long long a, long long b) {
  int x = 1, y = a;
  while (b > 0) {
    if (b % 2) {
      x = mul(x, y);
    }
    y = mul(y, y);
    b /= 2;
  }
  return (int)(x % mod);
}
vector<long long> uniq(vector<long long>& v) {
  sort(v.begin(), v.end());
  vector<long long> ret;
  if (v.size() == 0) {
    return ret;
  }
  ret.push_back(v[0]);
  for (int i = 1; i < v.size(); i++) {
    if (v[i] != v[i - 1]) {
      ret.push_back(v[i]);
    }
  }
  return ret;
}
int get(vector<long long>& v, long long x) {
  int low = 0, high = v.size() - 1;
  while (low < high) {
    int mid = (low + high + 1) >> 1;
    if (v[mid] <= x) {
      low = mid;
    } else {
      high = mid - 1;
    }
  }
  return low;
}
void dfs(int u) {
  vis[u] = 1;
  for (int x : al[u]) {
    if (!vis[x]) {
      dfs(x);
    }
  }
}
int solve(int i) {
  unordered_map<int, int> m1;
  for (pair<int, int> x : ed[i]) {
    int u = x.first, v = x.second;
    m1[x.first] = m1[x.second] = 1;
    al[u].push_back(v);
    al[v].push_back(u);
  }
  int present = m1.size(), ctr = n - present;
  for (auto x : m1) {
    if (!vis[x.first]) {
      ctr++;
      dfs(x.first);
    }
  }
  int res = poww(2, ctr);
  vis.clear();
  for (auto x : m1) {
    al[x.first].clear();
    al[x.second].clear();
  }
  return res;
}
int main() {
  scanf("%d%d%d", &n, &m, &k);
  long long tot = (1ll << k);
  vector<pair<int, int> > edges;
  for (int i = 0; i < n; i++) {
    scanf("%lld", &a[i]);
  }
  vector<long long> x;
  for (int i = 0; i < m; i++) {
    int u, v;
    scanf("%d%d", &u, &v);
    u--;
    v--;
    edges.push_back({u, v});
    x.push_back(a[u] ^ a[v]);
  }
  x = uniq(x);
  int left = (int)((tot - x.size()) % mod);
  int res = mul(left, poww(2, n));
  for (int i = 0; i < m; i++) {
    long long now = a[edges[i].first] ^ a[edges[i].second];
    int zz = get(x, now);
    ed[zz].push_back(edges[i]);
  }
  for (int i = 0; i < maxn; i++) {
    if (ed[i].size() > 0) {
      res = add(res, solve(i));
    }
  }
  printf("%d\n", res);
  return 0;
}
