#include <bits/stdc++.h>
using namespace std;
const int maxn = 1000 + 5;
int n, m, w;
int pa[maxn], val[maxn], cost[maxn];
int dp[maxn][maxn];
void init() {
  for (int i = 1; i <= n; i++) pa[i] = i;
}
int uf_find(int x) { return x == pa[x] ? x : pa[x] = uf_find(pa[x]); }
void uf_join(int x, int y) {
  int fx = uf_find(x), fy = uf_find(y);
  if (fx != fy) pa[fx] = fy;
}
int main() {
  scanf("%d%d%d", &n, &m, &w);
  init();
  for (int i = 1; i <= n; i++) {
    scanf("%d", &cost[i]);
  }
  for (int i = 1; i <= n; i++) {
    scanf("%d", &val[i]);
  }
  for (int i = 1; i <= m; i++) {
    int x, y;
    scanf("%d%d", &x, &y);
    uf_join(x, y);
  }
  vector<int> friends[maxn];
  for (int i = 1; i <= n; i++) {
    int root = uf_find(i);
    friends[root].push_back(i);
  }
  int idx = 0;
  for (int i = 1; i <= n; i++) {
    if (friends[i].size() == 0) {
      continue;
    }
    idx++;
    for (int j = 0; j <= w; j++) {
      dp[idx][j] = dp[idx - 1][j];
      int sum = 0, value = 0;
      for (int k = 0; k < friends[i].size(); k++) {
        int cur = friends[i][k];
        sum += cost[cur];
        value += val[cur];
        if (j >= cost[cur])
          dp[idx][j] = max(dp[idx][j], dp[idx - 1][j - cost[cur]] + val[cur]);
      }
      if (j >= sum) {
        dp[idx][j] = max(dp[idx][j], dp[idx - 1][j - sum] + value);
      }
    }
  }
  cout << dp[idx][w] << endl;
  return 0;
}
