#include <bits/stdc++.h>
using namespace std;
int N, Q, T;
bool matr[300][300];
int amounts[300];
vector<int> chains[300];
bool was[300];
int sorted[300];
int s = 0;
long long mas[2][100010];
void srt(int v) {
  was[v] = true;
  for (int i = 0; i < N; i++)
    if (!was[i] && matr[v][i]) srt(i);
  sorted[s] = v;
  s++;
}
bool z = false;
void f(int v, int c) {
  was[v] = true;
  for (int i = 0; i < N; i++)
    if (matr[v][i]) {
      if (was[i])
        z = true;
      else
        f(i, c);
    }
  chains[c].push_back(v);
}
int main() {
  scanf("%d%d%d", &N, &Q, &T);
  for (int i = 0; i < N; i++) scanf("%d", &amounts[i]);
  for (int i = 0; i < 300; i++)
    for (int j = 0; j < 300; j++) matr[i][j] = false;
  for (int i = 0; i < Q; i++) {
    int a, b;
    scanf("%d%d", &a, &b);
    a--;
    b--;
    matr[a][b] = true;
  }
  for (int i = 0; i < 300; i++) was[i] = false;
  for (int i = 0; i < N; i++)
    if (!was[i]) srt(i);
  reverse(sorted, sorted + N);
  for (int i = 0; i < 300; i++) was[i] = false;
  int cCnt = 0;
  for (int i = 0; i < N; i++)
    if (!was[sorted[i]]) {
      f(sorted[i], cCnt);
      cCnt++;
    }
  for (int i = 0; i < cCnt; i++) {
    for (int j = chains[i].size() - 1; j >= 0; j--) {
      chains[i][j] = amounts[chains[i][j]];
      if (j + 1 < chains[i].size()) chains[i][j] += chains[i][j + 1];
    }
  }
  if (z) {
    printf("%d\n", 0);
    return 0;
  }
  memset(mas, 0, sizeof(long long) * 100010 * 2);
  mas[0][0] = 1;
  int index = 0;
  for (int i = 0; i < cCnt; i++) {
    for (int j = 0; j < chains[i].size(); j++) {
      int amount = chains[i][j];
      for (int k = 0; k < 100010; k++) mas[(index + 1) % 2][k] = 0;
      for (int k = 0; k < 100010; k++) {
        if (k - amount >= 0)
          mas[index % 2][k] =
              (mas[index % 2][k] + mas[index % 2][k - amount]) % 1000000007;
        if (j == 0)
          mas[(index + 1) % 2][k] = mas[index % 2][k];
        else if (k - amount >= 0)
          mas[(index + 1) % 2][k] = mas[index % 2][k - amount];
      }
      index++;
    }
  }
  cout << mas[index % 2][T] << '\n';
  return 0;
}
