#include <bits/stdc++.h>
using namespace std;
template <typename T>
inline void ckmax(T& x, T y) {
  x = (y > x ? y : x);
}
template <typename T>
inline void ckmin(T& x, T y) {
  x = (y < x ? y : x);
}
namespace Fread {
const int SIZE = 1 << 21;
char buf[SIZE], *S, *T;
inline char getchar() {
  if (S == T) {
    T = (S = buf) + fread(buf, 1, SIZE, stdin);
    if (S == T) return '\n';
  }
  return *S++;
}
}  // namespace Fread
namespace Fwrite {
const int SIZE = 1 << 21;
char buf[SIZE], *S = buf, *T = buf + SIZE;
inline void flush() {
  fwrite(buf, 1, S - buf, stdout);
  S = buf;
}
inline void putchar(char c) {
  *S++ = c;
  if (S == T) flush();
}
struct NTR {
  ~NTR() { flush(); }
} ztr;
}  // namespace Fwrite
namespace Fastio {
struct Reader {
  template <typename T>
  Reader& operator>>(T& x) {
    char c = Fread ::getchar();
    T f = 1;
    while (c < '0' || c > '9') {
      if (c == '-') f = -1;
      c = Fread ::getchar();
    }
    x = 0;
    while (c >= '0' && c <= '9') {
      x = x * 10 + (c - '0');
      c = Fread ::getchar();
    }
    x *= f;
    return *this;
  }
  Reader& operator>>(char& c) {
    c = Fread ::getchar();
    while (c == '\n' || c == ' ') c = Fread ::getchar();
    return *this;
  }
  Reader& operator>>(char* str) {
    int len = 0;
    char c = Fread ::getchar();
    while (c == '\n' || c == ' ') c = Fread ::getchar();
    while (c != '\n' && c != ' ') {
      str[len++] = c;
      c = Fread ::getchar();
    }
    str[len] = '\0';
    return *this;
  }
  Reader() {}
} cin;
const char endl = '\n';
struct Writer {
  template <typename T>
  Writer& operator<<(T x) {
    if (x == 0) {
      Fwrite ::putchar('0');
      return *this;
    }
    if (x < 0) {
      Fwrite ::putchar('-');
      x = -x;
    }
    static int sta[45];
    int top = 0;
    while (x) {
      sta[++top] = x % 10;
      x /= 10;
    }
    while (top) {
      Fwrite ::putchar(sta[top] + '0');
      --top;
    }
    return *this;
  }
  Writer& operator<<(char c) {
    Fwrite ::putchar(c);
    return *this;
  }
  Writer& operator<<(char* str) {
    int cur = 0;
    while (str[cur]) Fwrite ::putchar(str[cur++]);
    return *this;
  }
  Writer& operator<<(const char* str) {
    int cur = 0;
    while (str[cur]) Fwrite ::putchar(str[cur++]);
    return *this;
  }
  Writer() {}
} cout;
}  // namespace Fastio
const int MAXN = 5e5;
const int MOD = 1e9 + 7;
inline int mod1(int x) { return x < MOD ? x : x - MOD; }
inline int mod2(int x) { return x < 0 ? x + MOD : x; }
inline void add(int& x, int y) { x = mod1(x + y); }
inline void sub(int& x, int y) { x = mod2(x - y); }
inline int pow_mod(int x, int i) {
  int y = 1;
  while (i) {
    if (i & 1) y = (long long)y * x % MOD;
    x = (long long)x * x % MOD;
    i >>= 1;
  }
  return y;
}
int n, m, K;
long long a[MAXN + 5];
pair<int, int> e[MAXN + 5];
long long vals[MAXN + 5];
int cnt_val;
int nodes[MAXN * 2 + 5], cnt_node;
vector<pair<int, int> > e_of_w[MAXN + 5];
int fa[MAXN + 5], sz[MAXN + 5];
int get_fa(int u) { return (u == fa[u]) ? u : (fa[u] = get_fa(fa[u])); }
void unite(int u, int v) {
  u = get_fa(u);
  v = get_fa(v);
  if (u != v) {
    if (sz[u] > sz[v]) swap(u, v);
    fa[u] = v;
    sz[v] += sz[u];
  }
}
int main() {
  Fastio ::cin >> n >> m >> K;
  for (int i = 1; i <= n; ++i) {
    Fastio ::cin >> a[i];
  }
  for (int i = 1; i <= m; ++i) {
    Fastio ::cin >> e[i].first >> e[i].second;
    vals[++cnt_val] = (a[e[i].first] ^ a[e[i].second]);
  }
  sort(vals + 1, vals + cnt_val + 1);
  cnt_val = unique(vals + 1, vals + cnt_val + 1) - (vals + 1);
  int ans = ((1LL << K) - cnt_val) % MOD * pow_mod(2, n) % MOD;
  for (int i = 1; i <= m; ++i) {
    int w = lower_bound(vals + 1, vals + cnt_val + 1,
                        (a[e[i].first] ^ a[e[i].second])) -
            vals;
    e_of_w[w].push_back(e[i]);
  }
  for (int i = 1; i <= cnt_val; ++i) {
    cnt_node = 0;
    for (int j = 0; j < ((int)(e_of_w[i]).size()); ++j) {
      int u = e_of_w[i][j].first, v = e_of_w[i][j].second;
      nodes[++cnt_node] = u;
      nodes[++cnt_node] = v;
    }
    sort(nodes + 1, nodes + cnt_node + 1);
    cnt_node = unique(nodes + 1, nodes + cnt_node + 1) - (nodes + 1);
    for (int j = 1; j <= cnt_node; ++j) {
      int u = nodes[j];
      fa[u] = u;
      sz[u] = 1;
    }
    for (int j = 0; j < ((int)(e_of_w[i]).size()); ++j) {
      int u = e_of_w[i][j].first, v = e_of_w[i][j].second;
      unite(u, v);
    }
    int cnt = n - cnt_node;
    for (int j = 1; j <= cnt_node; ++j) {
      int u = nodes[j];
      cnt += (get_fa(u) == u);
    }
    add(ans, pow_mod(2, cnt));
  }
  Fastio ::cout << ans << Fastio ::endl;
  return 0;
}
