#include <bits/stdc++.h>
using namespace std;
int n, m, w;
int weight[2000], beauty[2000];
int father[2000], group[2000];
int dp[2000];
int find(int x) {
  if (!father[x]) return x;
  return father[x] = find(father[x]);
}
int max(int x, int y) { return x > y ? x : y; }
void solve() {
  for (int i = 1; i <= n; ++i) {
    if (!father[i]) {
      int cnt = 0, tw = 0, tb = 0;
      for (int j = 1; j <= n; ++j) {
        if (find(j) == i) {
          group[++cnt] = j;
          tw += weight[j];
          tb += beauty[j];
        }
      }
      for (int j = w; j >= 0; --j) {
        for (int k = 1; k <= cnt; ++k) {
          if (j >= weight[group[k]])
            dp[j] = max(dp[j], dp[j - weight[group[k]]] + beauty[group[k]]);
        }
        if (j >= tw) dp[j] = max(dp[j], dp[j - tw] + tb);
      }
    }
  }
  printf("%d\n", dp[w]);
  return;
}
int main() {
  scanf("%d%d%d", &n, &m, &w);
  for (int i = 1; i <= n; ++i) scanf("%d", &weight[i]);
  for (int i = 1; i <= n; ++i) scanf("%d", &beauty[i]);
  for (int i = 1; i <= m; ++i) {
    int x, y;
    scanf("%d%d", &x, &y);
    int tmp1 = find(x);
    int tmp2 = find(y);
    if (tmp1 != tmp2) father[tmp2] = tmp1;
  }
  solve();
  return 0;
}
