#include <bits/stdc++.h>
const long long mod = 1e9 + 7;
const long long inf = std::numeric_limits<long long>::max();
using namespace std;
long long c[500100];
vector<pair<long long, long long> > g[500100];
map<long long, int> mp;
int last[500100];
vector<int> s[500100];
bool seen[500100];
int ted, cnt;
void dfs(int i, long long u) {
  ted++;
  seen[i] = true;
  while (last[i] < g[i].size() && g[i][last[i]].first == u) {
    if (seen[g[i][last[i]].second]) {
      last[i]++;
      continue;
    }
    dfs(g[i][last[i]].second, u);
    last[i]++;
  }
}
long long pw[500100];
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cnt = 0;
  long long k = 0;
  int n, m;
  cin >> n >> m >> k;
  for (int i = 0; i < n; i++) cin >> c[i];
  for (int i = 0; i < m; i++) {
    int x, y;
    cin >> x >> y;
    x--, y--;
    g[x].push_back({c[x] ^ c[y], y});
    g[y].push_back({c[x] ^ c[y], x});
    if (mp.find(c[x] ^ c[y]) == mp.end()) mp[c[x] ^ c[y]] = cnt++;
    s[mp[c[x] ^ c[y]]].push_back(x);
    s[mp[c[x] ^ c[y]]].push_back(y);
  }
  pw[0] = 1;
  for (int i = 1; i < 500100; i++) {
    pw[i] = pw[i - 1] * 2 % mod;
  }
  for (int i = 0; i < n; i++) {
    sort(g[i].begin(), g[i].end());
  }
  long long ans = 0;
  int cnt2 = 0;
  int tedmp = 0;
  for (auto i : mp) {
    tedmp++;
    for (int j : s[i.second]) {
      if (seen[j]) continue;
      dfs(j, i.first);
      cnt2++;
    }
    for (int j : s[i.second]) {
      seen[j] = false;
    }
    ans += pw[n - ted + cnt2];
    ted = 0;
    cnt2 = 0;
    ans %= mod;
  }
  ans += (pw[k] - tedmp) * pw[n] % mod;
  ans %= mod;
  cout << ans;
  return 0;
}
