#include <bits/stdc++.h>
using namespace std;
vector<vector<int> > wt, price;
vector<int> kaif, salman;
vector<int> arr[10004];
int mark[10004];
long long int dp[1600][1002];
void dfs(int i, vector<int>& dd) {
  dd.push_back(i);
  mark[i] = 1;
  for (int j = 0; j < arr[i].size(); j++) {
    if (mark[arr[i][j]] == 1) continue;
    dfs(arr[i][j], dd);
  }
}
long long int recurse(int i, int weight) {
  if (i < 0 || weight == 0) return 0;
  if (dp[i][weight] != -1) return dp[i][weight];
  long long int kkk = 0;
  for (int j = 0; j < wt[i].size(); j++) {
    if (wt[i][j] > weight)
      kkk = max(kkk, recurse(i - 1, weight));
    else {
      long long int fff = max(price[i][j] + recurse(i - 1, weight - wt[i][j]),
                              recurse(i - 1, weight));
      kkk = max(kkk, fff);
    }
  }
  return dp[i][weight] = kkk;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int n, m, w;
  cin >> n >> m >> w;
  for (int i = 1; i <= n; i++) {
    int a;
    cin >> a;
    kaif.push_back(a);
  }
  for (int i = 1; i <= n; i++) {
    int a;
    cin >> a;
    salman.push_back(a);
  }
  for (int i = 0; i < m; i++) {
    int a, b;
    cin >> a >> b;
    arr[a - 1].push_back(b - 1);
    arr[b - 1].push_back(a - 1);
  }
  for (int i = 0; i < n; i++) {
    if (mark[i] == 0) {
      vector<int> dd, su, we;
      dfs(i, dd);
      int ts = 0, tw = 0;
      for (int j = 0; j < dd.size(); j++) {
        su.push_back(salman[dd[j]]);
        we.push_back(kaif[dd[j]]);
        ts += salman[dd[j]];
        tw += kaif[dd[j]];
      }
      su.push_back(ts);
      we.push_back(tw);
      wt.push_back(we);
      price.push_back(su);
    }
  }
  memset(dp, -1, sizeof(dp));
  cout << recurse(wt.size() - 1, w);
  return 0;
}
