#include <bits/stdc++.h>
using namespace std;
enum { WHITE = 0, GRAY, BLACK };
enum { UNVISITED = -1 };
const double pi = 2 * acos(0);
const double tau = 2.0 * pi;
int pass = 1;
long long w[1005], b[1005], wh[1005], bh[1005];
vector<int> H[1005];
long long f(int i, int j) {
  if (i < 1) return 0;
  static long long dp[1005][1005];
  static int mark[1005][1005] = {};
  auto& ans = dp[i][j];
  if (mark[i][j] == pass) return ans;
  mark[i][j] = pass;
  ans = f(i - 1, j);
  if (w[i] <= j) ans = max(ans, f(i - 1, j - w[i]) + b[i]);
  for (int h : H[i])
    if (wh[h] <= j) ans = max(ans, f(i - 1, j - wh[h]) + bh[h]);
  return ans;
}
int main() {
  long long n, m, W;
  cin >> n >> m >> W;
  for (int i = 1, ENDD = n; i <= ENDD; i++) cin >> wh[i];
  for (int i = 1, ENDD = n; i <= ENDD; i++) cin >> bh[i];
  vector<vector<int> > G(n + 1);
  for (int i = 1, ENDD = m; i <= ENDD; i++) {
    int x, y;
    cin >> x >> y;
    G[x].push_back(y);
    G[y].push_back(x);
  }
  vector<bool> visited(n + 1, false);
  int C = 0;
  for (int s = 1, ENDD = n; s <= ENDD; s++)
    if (!visited[s]) {
      C++;
      queue<int> Q;
      Q.push(s);
      visited[s] = true;
      w[C] += wh[s];
      b[C] += bh[s];
      H[C].push_back(s);
      while (!Q.empty()) {
        int u = Q.front();
        Q.pop();
        for (int v : G[u])
          if (!visited[v]) {
            Q.push(v);
            visited[v] = true;
            w[C] += wh[v];
            b[C] += bh[v];
            H[C].push_back(v);
          }
      }
    }
  cout << f(C, W) << endl;
  return 0;
}
