#include <bits/stdc++.h>
using namespace std;
namespace io {
const int __SIZE = (1 << 21) + 1;
char ibuf[__SIZE], *iS, *iT, obuf[__SIZE], *oS = obuf, *oT = oS + __SIZE - 1,
                                           __c, qu[55];
int __f, qr, _eof;
inline void flush() { fwrite(obuf, 1, oS - obuf, stdout), oS = obuf; }
inline void gc(char& x) {
  x = (iS == iT ? (iT = (iS = ibuf) + fread(ibuf, 1, __SIZE, stdin),
                   (iS == iT ? EOF : *iS++))
                : *iS++);
}
inline void pc(char x) {
  *oS++ = x;
  if (oS == oT) flush();
}
inline void pstr(const char* s) {
  int __len = strlen(s);
  for (__f = 0; __f < __len; ++__f) pc(s[__f]);
}
inline void gstr(char* s) {
  for (__c = (iS == iT ? (iT = (iS = ibuf) + fread(ibuf, 1, __SIZE, stdin),
                         (iS == iT ? EOF : *iS++))
                       : *iS++);
       __c < 32 || __c > 126 || __c == ' ';)
    __c = (iS == iT ? (iT = (iS = ibuf) + fread(ibuf, 1, __SIZE, stdin),
                       (iS == iT ? EOF : *iS++))
                    : *iS++);
  for (; __c > 31 && __c < 127 && __c != ' ';
       ++s, __c = (iS == iT ? (iT = (iS = ibuf) + fread(ibuf, 1, __SIZE, stdin),
                              (iS == iT ? EOF : *iS++))
                            : *iS++))
    *s = __c;
  *s = 0;
}
template <class I>
inline bool gi(I& x) {
  _eof = 0;
  for (__f = 1,
      __c = (iS == iT ? (iT = (iS = ibuf) + fread(ibuf, 1, __SIZE, stdin),
                        (iS == iT ? EOF : *iS++))
                      : *iS++);
       (__c < '0' || __c > '9') && !_eof;
       __c = (iS == iT ? (iT = (iS = ibuf) + fread(ibuf, 1, __SIZE, stdin),
                         (iS == iT ? EOF : *iS++))
                       : *iS++)) {
    if (__c == '-') __f = -1;
    _eof |= __c == EOF;
  }
  for (x = 0; __c <= '9' && __c >= '0' && !_eof;
       __c = (iS == iT ? (iT = (iS = ibuf) + fread(ibuf, 1, __SIZE, stdin),
                         (iS == iT ? EOF : *iS++))
                       : *iS++))
    x = x * 10 + (__c & 15), _eof |= __c == EOF;
  x *= __f;
  return !_eof;
}
template <class I>
inline void print(I x) {
  if (!x) pc('0');
  if (x < 0) pc('-'), x = -x;
  while (x) qu[++qr] = x % 10 + '0', x /= 10;
  while (qr) pc(qu[qr--]);
}
struct Flusher_ {
  ~Flusher_() { flush(); }
} io_flusher_;
}  // namespace io
using io::gc;
using io::gi;
using io::gstr;
using io::pc;
using io::print;
using io::pstr;
using ll = long long;
using pii = pair<int, int>;
const int MOD = 1000000007;
ll c[500005];
int p2[500005];
map<ll, vector<pii>> NO;
int bcj[500006], ltk;
void binit() { memset(bcj, -1, sizeof bcj); }
int bget(int i) { return (bcj[i] < 0) ? i : (bcj[i] = bget(bcj[i])); }
void bmerge(int i, int j) {
  int ri = bget(i), rj = bget(j);
  if (ri == rj) {
    return;
  }
  ltk--;
  if (bcj[ri] > bcj[rj]) {
    swap(ri, rj);
  }
  bcj[ri] += bcj[rj];
  bcj[rj] = ri;
}
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  int n, m, k;
  gi(n), gi(m), gi(k);
  for (int i = (1); i < ((n) + 1); i++) gi(c[i]);
  p2[0] = 1;
  for (int i = (1); i < ((n) + 1); i++) {
    p2[i] = 2 * p2[i - 1];
    if (p2[i] >= MOD) p2[i] -= MOD;
  }
  while (m--) {
    int u, v;
    gi(u), gi(v);
    auto& ref = NO[c[u] ^ c[v]];
    ref.push_back({u, v});
  }
  ll notinno = (1ll << k) - NO.size();
  ll ans = 1ll * (notinno % MOD) * p2[n] % MOD;
  binit();
  for (auto& k : NO) {
    ltk = n;
    for (auto& i : k.second) bmerge(i.first, i.second);
    ans += p2[ltk];
    for (auto& i : k.second) bcj[i.first] = bcj[i.second] = -1;
    if (ans >= MOD) ans -= MOD;
  }
  print(ans);
}
