#include <bits/stdc++.h>
using namespace std;
const long long MOD = (long long)1e9 + 7;
struct Edge {
  int u, v;
  Edge() {}
  Edge(int u, int v) : u(u), v(v) {}
} edge[500010];
int cnt;
vector<int> v[500010];
void addedge(int rt, int a, int b) {
  edge[++cnt] = Edge(a, b);
  v[rt].push_back(cnt);
}
int n, m, k;
long long Bit[500010], arr[500010];
unordered_map<long long, int> mp;
int pos;
int Get(long long x) {
  if (mp.find(x) == mp.end()) mp[x] = ++pos;
  return mp[x];
}
struct UF {
  int fa[500010], sz;
  void init() {
    memset(fa, -1, sizeof fa);
    sz = n;
  }
  int find(int x) { return fa[x] == -1 ? x : fa[x] = find(fa[x]); }
  void join(int x, int y) {
    int fx = find(x), fy = find(y);
    if (fx > fy) swap(fx, fy);
    if (fx != fy) {
      fa[fx] = fy;
      --sz;
    }
  }
} uf;
namespace FastIO {
bool IOerror = false;
inline char NC() {
  static char buf[10000005], *p1 = buf + 10000005, *pend = buf + 10000005;
  if (p1 == pend) {
    p1 = buf;
    pend = buf + fread(buf, 1, 10000005, stdin);
    if (pend == p1) {
      IOerror = true;
      return -1;
    }
  }
  return *p1++;
}
inline bool blank(char ch) {
  return ch == ' ' || ch == '\n' || ch == '\r' || ch == '\t';
}
inline void __read(char &x) {
  char ch;
  while (blank(ch = NC()))
    ;
  if (IOerror) {
    x = -1;
    return;
  }
  x = ch;
}
template <typename T>
inline void __read(T &x) {
  char ch;
  while (blank(ch = NC()))
    ;
  if (IOerror) {
    x = -1;
    return;
  }
  bool flag = false;
  if (ch == '-') {
    flag = true;
    ch = NC();
  }
  if (!isdigit(ch))
    while (!isdigit(ch = NC()))
      ;
  for (x = ch - '0'; isdigit(ch = NC()); x = x * 10 + ch - '0')
    ;
  if (flag) x *= -1;
}
}  // namespace FastIO
using namespace FastIO;
void Run() {
  Bit[0] = 1ll;
  __read(n), __read(m), __read(k);
  for (int i = 1; i <= 500000; ++i) Bit[i] = (Bit[i - 1] * 2ll) % MOD;
  uf.init();
  for (int i = 1; i <= n; ++i) __read(arr[i]);
  for (int i = 1, a, b; i <= m; ++i) {
    __read(a), __read(b);
    long long tmp = arr[a] ^ arr[b];
    int pos = Get(tmp);
    addedge(pos, a, b);
  }
  long long res = (Bit[k] - pos + MOD) * Bit[n] % MOD;
  for (int i = 1; i <= pos; ++i) {
    uf.sz = n;
    for (auto it : v[i]) uf.join(edge[it].u, edge[it].v);
    res = (res + Bit[uf.sz]) % MOD;
    for (auto it : v[i]) {
      uf.fa[edge[it].u] = -1;
      uf.fa[edge[it].v] = -1;
    }
  }
  printf("%lld\n", res);
}
int main() {
  Run();
  return 0;
}
