#include <bits/stdc++.h>
using namespace std;
const int MAX = 1005;
int N, M, W;
vector<vector<int>> e;
int ne[MAX];
int D[MAX];
int D2[MAX];
int b[MAX], w[MAX];
int we[MAX], be[MAX];
int main() {
  int i, j, x, y, cnt = 1;
  cin >> N >> M >> W;
  for (i = 1; i <= N; i++) cin >> w[i];
  for (i = 1; i <= N; i++) cin >> b[i];
  for (i = 1; i <= M; i++) {
    cin >> x >> y;
    if (ne[x] != 0 && ne[y] == 0)
      ne[y] = ne[x];
    else if (ne[y] != 0 && ne[x] == 0)
      ne[x] = ne[y];
    else if (ne[y] == ne[x] && ne[y] == 0)
      ne[x] = ne[y] = cnt++;
    else {
      int t = ne[x];
      for (j = 1; j <= N; j++)
        if (ne[j] == t) ne[j] = ne[y];
    }
  }
  e.resize(cnt + 1);
  for (i = 1; i <= N; i++)
    if (ne[i] != 0) {
      e[ne[i]].push_back(i);
      we[ne[i]] += w[i];
      be[ne[i]] += b[i];
    }
  for (i = 1; i <= W; i++) D[i] = -1;
  for (i = 1; i < cnt; i++) {
    for (j = 0; j <= W; j++) D2[j] = D[j];
    for (const auto& x : e[i]) {
      for (j = 0; j + w[x] <= W; j++)
        if (D[j] != -1) D2[j + w[x]] = max(D2[j + w[x]], D[j] + b[x]);
    }
    for (j = W - we[i]; j >= 0; j--)
      D2[j + we[i]] = max(D2[j + we[i]], D[j] + be[i]);
    for (j = 0; j <= W; j++) D[j] = D2[j];
  }
  for (i = 1; i <= N; i++)
    if (ne[i] == 0) {
      for (j = W - w[i]; j >= 0; j--)
        D[j + w[i]] = max(D[j + w[i]], D[j] + b[i]);
    }
  int maxim = 0;
  for (i = 0; i <= W; i++) maxim = max(maxim, D[i]);
  cout << maxim;
  return 0;
}
