#include <bits/stdc++.h>
using namespace std;
const int N = 1005;
int n, m, W;
int w[N], b[N], weight[N];
long long beauty[N];
long long dp[2 * N][N];
int f[N];
int find(int x) { return x == f[x] ? x : f[x] = find(f[x]); }
vector<int> comp[N];
int main() {
  scanf("%d%d%d", &n, &m, &W);
  for (int i = 0; i < n; ++i) scanf("%d", &w[i]);
  for (int i = 0; i < n; ++i) scanf("%d", &b[i]);
  for (int i = 0; i < n; ++i) f[i] = i;
  for (int i = 0; i < m; ++i) {
    int u, v;
    scanf("%d%d", &u, &v);
    --u, --v;
    if (find(u) != find(v)) {
      f[find(u)] = find(v);
    }
  }
  for (int i = 0; i < n; ++i) {
    comp[find(i)].push_back(i);
    weight[find(i)] += w[i];
    beauty[find(i)] += b[i];
  }
  int C = 1;
  for (int i = 0; i < n; ++i) {
    if (i == find(i)) {
      for (int j = 0; j <= W; ++j) dp[C][j] = dp[C - 1][j];
      for (int k = 0; k < comp[i].size(); ++k) {
        int u = comp[i][k];
        for (int j = w[u]; j <= W; ++j) {
          dp[C][j] = max(dp[C][j], dp[C - 1][j - w[u]] + b[u]);
        }
      }
      for (int j = weight[i]; j <= W; ++j) {
        dp[C][j] = max(dp[C][j], dp[C - 1][j - weight[i]] + beauty[i]);
      }
      C++;
    }
  }
  cout << *max_element(dp[C - 1], dp[C - 1] + W + 1) << endl;
}
