#include <bits/stdc++.h>
using namespace std;
vector<int> s[1000 + 10];
int mark[1000 + 10], q[1000 + 10][1000 + 10], dp[1000 + 10][1000 + 10], mc = 0;
void dfs(int x, int n, int c) {
  if (mark[x] == 0) {
    mark[x] = c;
    q[c][mc] = x + 1;
    mc++;
    for (int i = 0; i < s[x].size(); i++) dfs(s[x][i], n, c);
  }
}
int main() {
  int n, m, w, o;
  cin >> n >> m >> w;
  o = n;
  int d[1000 + 1000 + 10], b[1000 + 1000 + 10];
  for (int i = 0; i < n; i++) cin >> d[i];
  for (int i = 0; i < n; i++) cin >> b[i];
  for (int i = 0; i < m; i++) {
    int u, v;
    cin >> u >> v;
    s[--u].push_back(--v);
    s[v].push_back(u);
  }
  int c = 0;
  for (int i = 0; i < n; i++) {
    if (mark[i] == 0) {
      c++;
      dfs(i, n, c);
      mc = 0;
    }
  }
  for (int i = 1; i < c + 1; i++) {
    int x = 0, y = 0;
    int j;
    for (j = 0; j < 1000 + 10; j++) {
      if (q[i][j] == 0)
        break;
      else {
        x += d[q[i][j] - 1];
        y += b[q[i][j] - 1];
      }
    }
    d[o] = x;
    b[o] = y;
    o++;
    q[i][j] = o;
  }
  for (int i = 1; i < w + 1; i++) {
    for (int j = 1; j < c + 1; j++) {
      dp[i][j] = dp[i][j - 1];
      for (int t = 0; t < 1000 + 10; t++) {
        if (q[j][t] == 0)
          break;
        else {
          int x = q[j][t] - 1;
          if (d[x] <= i) {
            dp[i][j] = max(dp[i][j], (dp[(i - d[x])][j - 1]) + b[x]);
          }
        }
      }
    }
  }
  cout << dp[w][c];
}
