#include <bits/stdc++.h>
using namespace std;
inline char gc() {
  static char buf[100000], *p1 = buf, *p2 = buf;
  return p1 == p2 && (p2 = (p1 = buf) + fread(buf, 1, 100000, stdin), p1 == p2)
             ? EOF
             : *p1++;
}
inline long long read() {
  long long x = 0;
  char ch = getchar();
  bool positive = 1;
  for (; !isdigit(ch); ch = getchar())
    if (ch == '-') positive = 0;
  for (; isdigit(ch); ch = getchar()) x = x * 10 + ch - '0';
  return positive ? x : -x;
}
inline void write(long long x) {
  if (x < 0) x = -x, putchar('-');
  if (x > 9) write(x / 10);
  putchar(x % 10 + '0');
}
inline void writeln(long long x) {
  write(x);
  puts("");
}
struct Node {
  long long l, r, num;
  inline bool operator<(const Node& x) const { return num < x.num; }
} e[500005];
const long long mod = 1e9 + 7;
long long n, m, k, s, cnt, ans, sum, size, a[500005], fa[500005];
inline long long find(long long x) {
  return fa[x] == x ? x : fa[x] = find(fa[x]);
}
inline long long pow(long long x, long long y) {
  long long ans = 1;
  while (y) {
    if (y & 1) ans = ans * x % mod;
    x = x * x % mod;
    y >>= 1;
  }
  return ans;
}
int main() {
  n = read();
  m = read();
  k = read();
  for (long long i = 1; i <= n; i++) a[i] = read();
  for (long long i = 1; i <= m; i++) {
    e[i].l = read();
    e[i].r = read();
    e[i].num = a[e[i].l] ^ a[e[i].r];
  }
  sort(e + 1, e + m + 1);
  for (long long i = 1; i <= n; i++) fa[i] = i;
  s = 1;
  for (long long i = 2; i <= m; i++) {
    if (e[i].num != e[i - 1].num) {
      cnt++;
      sum = n;
      for (long long j = s; j < i; j++) {
        if (find(e[j].l) != find(e[j].r)) {
          sum--;
          fa[find(e[j].l)] = find(e[j].r);
        }
      }
      ans = (ans + pow(2ll, sum)) % mod;
      for (long long j = s; j < i; j++) {
        fa[e[j].l] = e[j].l;
        fa[e[j].r] = e[j].r;
      }
      s = i;
    }
  }
  sum = n;
  cnt++;
  for (long long i = s; i <= m; i++) {
    if (find(e[i].l) != find(e[i].r)) {
      sum--;
      fa[find(e[i].l)] = find(e[i].r);
    }
  }
  ans = ((ans + pow(2ll, sum)) % mod +
         (pow(2ll, k) - cnt + mod) % mod * pow(2ll, n) % mod) %
        mod;
  writeln(ans);
  return 0;
}
