#include <bits/stdc++.h>
using namespace std;
bool vis[1005];
vector<int> asd[1005];
int dp[1005];
int mark, save[1005];
int n, m, tot, w[1005], v[1005];
void dfs(int x) {
  vis[x] = 1;
  save[mark++] = x;
  for (int i = 0; i < asd[x].size(); i++) {
    if (!vis[asd[x][i]]) dfs(asd[x][i]);
  }
}
int main() {
  cin >> n >> m >> tot;
  memset(vis, 0, sizeof(vis));
  memset(dp, 0, sizeof(dp));
  int i, j;
  for (i = 1; i <= n; i++) scanf("%d", w + i);
  for (i = 1; i <= n; i++) scanf("%d", v + i);
  int x, y;
  while (m--) {
    scanf("%d%d", &x, &y);
    asd[x].push_back(y);
    asd[y].push_back(x);
  }
  int cur = 0;
  for (i = 1; i <= n; i++) {
    mark = 0;
    if (!vis[i]) {
      dfs(i);
      for (j = tot; j >= 0; j--) {
        int sumw = 0, sumv = 0;
        for (x = 0; x < mark; x++) {
          if (j >= w[save[x]])
            dp[j] = max(dp[j], dp[j - w[save[x]]] + v[save[x]]);
          sumw += w[save[x]], sumv += v[save[x]];
        }
        if (j >= sumw) dp[j] = max(dp[j], dp[j - sumw] + sumv);
      }
    }
  }
  cout << dp[tot];
  return 0;
}
