#include <bits/stdc++.h>
using namespace std;
void go(int c, int x, vector<bool>& seen, vector<vector<int>>& V,
        vector<int>& G) {
  G[x] = c;
  seen[x] = true;
  for (auto e : V[x])
    if (!seen[e]) go(c, e, seen, V, G);
}
long long ret[2000][1001];
int main() {
  int N, M, w;
  scanf("%d %d %d", &N, &M, &w);
  vector<int> W(N);
  vector<int> B(N);
  for (auto& e : W) scanf("%d ", &e);
  for (auto& e : B) scanf("%d ", &e);
  vector<vector<int>> V(N);
  for (int i = 0; i < M; i++) {
    int x, y;
    scanf("%d %d", &x, &y);
    x--;
    y--;
    V[x].push_back(y);
    V[y].push_back(x);
  }
  vector<int> G(N);
  vector<bool> seen(N);
  vector<int> WG;
  vector<long long> BG;
  vector<bool> mark;
  for (auto& e : G) e = -1;
  for (int i = 0; i < N; i++) {
    if (seen[i]) continue;
    go(i, i, seen, V, G);
    int a = 0;
    long long b = 0;
    for (int j = 0; j < N; j++)
      if (G[j] == i) {
        a += W[j], b += B[j];
        WG.push_back(W[j]);
        BG.push_back(B[j]);
        mark.push_back(false);
      }
    WG.push_back(a);
    BG.push_back(b);
    mark.push_back(true);
  }
  int chosen = 0;
  for (int j = 1; j <= w; j++) {
    int last = -1;
    last = -1;
    for (int i = 0; i < WG.size();) {
      chosen = i;
      int z = i;
      ret[i][j] = (last >= 0 ? ret[last][j] : 0);
      for (z = i;; z++) {
        if (WG[z] <= j)
          ret[i][j] =
              max(ret[i][j], (last >= 0 ? ret[last][j - WG[z]] : 0) + BG[z]);
        if (mark[z]) break;
      }
      last = i;
      i = z + 1;
    }
  }
  printf("%I64d\n", ret[chosen][w]);
  return 0;
}
