#include <bits/stdc++.h>
#pragma comment(linker, "/STACK:1024000000,1024000000")
using namespace std;
int n, m, w;
int wi[1005], b[1005], p[1005];
int find(int x) {
  if (x != p[x]) {
    p[x] = find(p[x]);
  }
  return p[x];
}
vector<int> G[1005];
int sum_wei[1005], sum_p[1005];
int chld[1005];
int main() {
  memset(sum_wei, 0, sizeof(sum_wei));
  memset(sum_p, 0, sizeof(sum_p));
  memset(chld, 0, sizeof(chld));
  scanf("%d", &n);
  scanf("%d", &m);
  scanf("%d", &w);
  for (int i = 1; i <= n; i++) scanf("%d", &wi[i]);
  for (int i = 1; i <= n; i++) scanf("%d", &b[i]);
  for (int i = 0; i <= n; i++) p[i] = i;
  for (int i = 1; i <= m; i++) {
    int u, v, x, y;
    scanf("%d", &u);
    scanf("%d", &v);
    x = find(u);
    y = find(v);
    if (x != y) p[x] = y;
  }
  int cnt = 0;
  for (int i = 1; i <= n; i++) {
    int t = find(p[i]);
    sum_wei[t] += wi[i];
    sum_p[t] += b[i];
    G[t].push_back(i);
    if (p[i] == i) cnt++;
  }
  for (int i = 1; i <= n; i++) {
    for (int j1 = w; j1 >= 0; j1--) {
      if (G[i].size() == 0) continue;
      for (int j = 0; j <= G[i].size() - 1; j++) {
        int w1, b1;
        w1 = wi[G[i][j]];
        b1 = b[G[i][j]];
        if (j1 >= w1) {
          chld[j1] = max(chld[j1], chld[j1 - w1] + b1);
        }
      }
      if (j1 >= sum_wei[i])
        chld[j1] = max(chld[j1], chld[j1 - sum_wei[i]] + sum_p[i]);
    }
  }
  int ans = -9999999;
  printf("%d\n", chld[w]);
  return 0;
}
