#include <bits/stdc++.h>
const long long mod = 1e8 + 7;
const long long eps = 1e-12;
using namespace std;
int n, m, W, x, y, w[1005], c[1005], f[1005], dp[1005][1005];
vector<int> q[1005];
int get_far(int x) { return f[x] == x ? x : f[x] = get_far(f[x]); }
int main() {
  ios_base::sync_with_stdio(0), cin.tie(0);
  while (cin >> n >> m >> W) {
    for (int(i) = (0); (i) <= (1005 - 1); ++(i)) f[i] = i;
    for (int(i) = (1); (i) <= (n); ++(i)) cin >> w[i];
    for (int(i) = (1); (i) <= (n); ++(i)) cin >> c[i];
    for (int(i) = (1); (i) <= (m); ++(i)) {
      cin >> x >> y;
      int a = get_far(x), b = get_far(y);
      if (a != b) f[a] = b;
    }
    for (int(i) = (0); (i) <= (1005 - 1); ++(i)) q[i].clear();
    for (int(i) = (1); (i) <= (n); ++(i)) {
      int x = get_far(i);
      q[x].push_back(i);
    }
    memset((dp), (0), sizeof((dp)));
    int ans = 0;
    for (int(i) = (1); (i) <= (n); ++(i)) {
      for (int(j) = (0); (j) <= (W); ++(j)) dp[i][j] = dp[i - 1][j];
      int x = get_far(i);
      if (x != i) continue;
      int sum1 = 0, sum2 = 0;
      for (int(j) = (0); (j) <= (q[x].size() - 1); ++(j)) {
        for (int(k) = (W); (k) >= (w[q[x][j]]); --(k))
          dp[i][k] = max(dp[i][k], dp[i - 1][k - w[q[x][j]]] + c[q[x][j]]);
        sum1 += w[q[x][j]];
        sum2 += c[q[x][j]];
      }
      for (int(j) = (W); (j) >= (sum1); --(j))
        dp[i][j] = max(dp[i][j], dp[i - 1][j - sum1] + sum2);
      for (int(j) = (0); (j) <= (W); ++(j)) ans = max(ans, dp[i][j]);
    }
    cout << ans << endl;
  }
  return 0;
}
