#include <bits/stdc++.h>
using namespace std;
long long n, m, wm;
long long b[1005], w[1005];
int r[1005];
int visitado[1005];
vector<pair<long long, long long> > v;
vector<int> g[1005];
long long t[1003][1003];
long long inf = 999999999999999999;
int p[1005];
long long ind[1005];
long long reind[1005];
bool cmp(int a, int b) { return p[a] < p[b]; }
pair<long long, long long> dfs(int atual, int indice) {
  if (visitado[atual]) return make_pair(0, 0);
  visitado[atual] = 1;
  p[atual] = indice;
  long long peso = 0, lindeza = 0;
  for (int i = 0; i < g[atual].size(); i++) {
    int prox = g[atual][i];
    pair<long long, long long> ret = dfs(prox, indice);
    peso += ret.first, lindeza += ret.second;
  }
  return make_pair(peso + w[atual], lindeza + b[atual]);
}
long long solve(int atual, long long peso) {
  if (peso > wm) return -inf;
  if (atual == n) return 0;
  long long &ret = t[atual][peso];
  if (ret != -1) return ret;
  int agora = ind[atual];
  int agora1 = reind[atual];
  ret = max(max(solve(r[atual], peso + v[p[agora]].first) + v[p[agora]].second,
                solve(r[atual], peso + w[agora]) + b[agora]),
            solve(atual + 1, peso));
  return ret;
}
int main() {
  ios::sync_with_stdio(false);
  cin >> n >> m >> wm;
  memset(t, -1, sizeof(t));
  for (int i = 0; i < n; i++) {
    cin >> w[i];
  }
  for (int i = 0; i < n; i++) {
    cin >> b[i];
  }
  for (int i = 0; i < m; i++) {
    int a, b;
    cin >> a >> b;
    a--, b--;
    g[a].push_back(b);
    g[b].push_back(a);
  }
  int indice = 0;
  for (int i = 0; i < n; i++) {
    ind[i] = i;
    if (visitado[i]) continue;
    pair<long long, long long> ret = dfs(i, indice);
    v.push_back(ret);
    indice++;
  }
  sort(ind, ind + n, cmp);
  int ant = 0, vant = p[ind[0]];
  for (int i = 1; i < n; i++) {
    int vat = p[ind[i]];
    if (vant != vat) {
      for (int j = ant; j < i; j++) {
        r[j] = i;
      }
      vant = vat;
      ant = i;
    }
  }
  for (int i = ant; i < n; i++) {
    r[i] = n;
  }
  cout << max(0LL, solve(0, 0)) << "\n";
  return 0;
}
