#include <bits/stdc++.h>
using namespace std;
void RD(int &x) { scanf("%d", &x); }
void RD(long long &x) { scanf("%I64d", &x); }
void RD(unsigned int &x) { scanf("%u", &x); }
void RD(double &x) { scanf("%lf", &x); }
void RD(int &x, int &y) { scanf("%d%d", &x, &y); }
void RD(long long &x, long long &y) { scanf("%I64d%I64d", &x, &y); }
void RD(unsigned int &x, unsigned int &y) { scanf("%u%u", &x, &y); }
void RD(double &x, double &y) { scanf("%lf%lf", &x, &y); }
void RD(int &x, int &y, int &z) { scanf("%d%d%d", &x, &y, &z); }
void RD(long long &x, long long &y, long long &z) {
  scanf("%I64d%I64d%I64d", &x, &y, &z);
}
void RD(unsigned int &x, unsigned int &y, unsigned int &z) {
  scanf("%u%u%u", &x, &y, &z);
}
void RD(double &x, double &y, double &z) { scanf("%lf%lf%lf", &x, &y, &z); }
void RD(char &x) { x = getchar(); }
void RD(char *s) { scanf("%s", s); }
void RD(string &s) { cin >> s; }
void PR(int x) { printf("%d\n", x); }
void PR(long long x) { printf("%I64d\n", x); }
void PR(unsigned int x) { printf("%u\n", x); }
void PR(double x) { printf("%.6lf\n", x); }
void PR(char x) { printf("%c\n", x); }
void PR(char *x) { printf("%s\n", x); }
void PR(string x) { cout << x << endl; }
const int mod = 1000000007;
const int N = 100005;
int a[305][305], n, m, p, f[N], b[305], c[305];
void DP() {
  f[0] = 1;
  int i, j, k, temp;
  for (i = 0; i < n; i++) {
    a[i][i] = 1;
    temp = 0;
    for (j = 0; j < n; j++)
      if (a[j][i]) temp += c[j];
    if (b[i]) {
      for (j = m; j >= temp; j--) f[j] = f[j - temp];
      while (j >= 0) f[j--] = 0;
    }
    for (j = temp; j <= m; j++) {
      (f[j] += f[j - temp]) %= mod;
    }
  }
  PR(f[m]);
}
int main() {
  RD(n, p, m);
  int i, j, k, x, y;
  for (i = 0; i < n; i++) RD(c[i]);
  while (p--) {
    RD(x, y);
    x--;
    y--;
    a[x][y] = 1;
    b[x] = 1;
  }
  for (k = 0; k < n; k++)
    for (i = 0; i < n; i++)
      for (j = 0; j < n; j++) {
        a[i][j] |= a[i][k] & a[k][j];
      }
  int flag = 0;
  for (i = 0; i < n; i++)
    for (j = 0; j < n; j++) flag |= a[i][j] & a[j][i];
  if (flag)
    puts("0");
  else
    DP();
  return 0;
}
