#include <bits/stdc++.h>
using namespace std;
const long long md = 1e9 + 7;
int64_t n, m, k, ans, a[500005];
int64_t power(int64_t a, int64_t p, int64_t m = 1e9 + 7) {
  return p ? power(a * a % m, p / 2, m) * (p & 1 ? a : 1) % m : 1;
}
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
struct DSU {
  unordered_map<int, int> par;
  int comp_sz = n;
  int get(int u) {
    if (!par.count(u)) return u;
    return par[u] = get(par[u]);
  }
  void unite(int x, int y) {
    int X = get(x), Y = get(y);
    if (X == Y) return;
    if (rng() % 2)
      par[Y] = X;
    else
      par[X] = Y;
    --comp_sz;
  }
};
map<int64_t, DSU> mp;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin >> n >> m >> k;
  for (int i = 1; i <= n; cin >> a[i++])
    ;
  for (int x, y; m--; mp[a[x] ^ a[y]].unite(x, y)) cin >> x >> y;
  for (auto i : mp) (ans += power(2, i.second.comp_sz)) %= md;
  cout << (power(2, n) * (power(2, k) - mp.size()) + ans) % md;
}
