#include <bits/stdc++.h>
using namespace std;
int parent[1010], sz[1010], n;
void init() {
  int i;
  for (i = 1; i <= n; i++) {
    parent[i] = i;
    sz[i] = 1;
  }
}
int root(int u) {
  while (parent[u] != u) {
    u = parent[parent[u]];
  }
  return u;
}
void union_make(int u, int v) {
  int root_u = root(u);
  int root_v = root(v);
  if (sz[root_u] > sz[root_v]) {
    parent[root_v] = parent[root_u];
    sz[root_u] += sz[root_v];
  } else {
    parent[root_u] = parent[root_v];
    sz[root_v] += sz[root_u];
  }
}
bool find_union(int u, int v) {
  if (root(u) == root(v))
    return true;
  else
    return false;
}
int beauty[1005], weight[1005], mxw;
vector<int> adj1[1005];
vector<int> adj2[1005];
pair<int, int> p[1005];
long long int dp[1005][1005];
int in;
long long int recur(int idx, int w) {
  if (idx < 1) return 0;
  if (dp[idx][w] != -1) return dp[idx][w];
  long long int ret1 = 0LL, ret2 = 0LL, ret3 = 0LL;
  if (w + p[idx].first <= mxw) {
    ret1 = p[idx].second + recur(idx - 1, w + p[idx].first);
  }
  ret2 = recur(idx - 1, w);
  int i, x;
  for (i = 0; i < adj2[idx].size(); i++) {
    x = adj2[idx][i];
    if (w + weight[x] <= mxw) {
      ret3 = max(ret3, beauty[x] + recur(idx - 1, w + weight[x]));
    }
  }
  return dp[idx][w] = max(ret1, max(ret2, ret3));
}
int main() {
  int m, i, x, y, cnt = 0LL, fp, j, sumB = 0, sumW = 0;
  cin >> n >> fp >> mxw;
  init();
  for (i = 1; i <= n; i++) {
    cin >> weight[i];
  }
  for (i = 1; i <= n; i++) {
    cin >> beauty[i];
  }
  for (i = 1; i <= fp; i++) {
    cin >> x >> y;
    union_make(x, y);
  }
  for (i = 1; i <= n; i++) {
    int r = root(i);
    adj1[r].push_back(i);
  }
  in = 0;
  for (i = 1; i <= n; i++) {
    if (adj1[i].size() > 0) {
      in++;
      sumB = 0;
      sumW = 0;
      for (j = 0; j < adj1[i].size(); j++) {
        x = adj1[i][j];
        adj2[in].push_back(x);
        sumB += beauty[x];
        sumW += weight[x];
      }
      p[in].first = sumW;
      p[in].second = sumB;
      adj1[i].clear();
    }
  }
  memset(dp, -1, sizeof dp);
  long long int ans = recur(in, 0);
  cout << ans << endl;
  return 0;
}
