#include <bits/stdc++.h>
using namespace std;
int parent[1001];
int n, m, W;
int F(int a) {
  if (a != parent[a]) parent[a] = F(parent[a]);
  return parent[a];
}
int main() {
  cin >> n >> m >> W;
  int w[n];
  int b[n];
  for (int i = 0; i < n; i++) cin >> w[i];
  for (int i = 0; i < n; i++) cin >> b[i];
  for (int i = 0; i < n; i++) parent[i] = i;
  ;
  for (int i = 0; i < m; i++) {
    int a, b;
    cin >> a >> b;
    a--;
    b--;
    parent[F(a)] = F(b);
  }
  vector<int> v[n];
  for (int i = 0; i < n; i++) {
    v[F(i)].push_back(i);
  }
  int dp[n + 1][W + 1];
  memset(dp, 0, sizeof dp);
  for (int sum = 1; sum <= W; sum++) {
    for (int index = 1; index <= n; index++) {
      dp[index][sum] = dp[index - 1][sum];
      int be = 0;
      int we = 0;
      for (int k = 0; k < v[index - 1].size(); k++) {
        if (sum - w[v[index - 1][k]] >= 0) {
          dp[index][sum] =
              max(dp[index][sum],
                  b[v[index - 1][k]] + dp[index - 1][sum - w[v[index - 1][k]]]);
        }
        be += b[v[index - 1][k]];
        we += w[v[index - 1][k]];
      }
      if (sum >= we)
        dp[index][sum] = max(dp[index][sum], be + dp[index - 1][sum - we]);
    }
  }
  cout << dp[n][W];
}
