#include <bits/stdc++.h>
using namespace std;
const double PI = 3.14159265358979323846;
const double EPS = 1e-12;
const int INF = numeric_limits<int>::max() / 2;
const int NEG_INF = numeric_limits<int>::min() / 2;
struct UnionFind {
  vector<int> par;
  int n, cnt;
  UnionFind(const int& x = 0) { init(x); }
  void init(const int& x) { par.assign(cnt = n = x, -1); }
  inline int find(const int& x) {
    return par[x] < 0 ? x : par[x] = find(par[x]);
  }
  inline bool same(const int& x, const int& y) { return find(x) == find(y); }
  inline bool unite(int x, int y) {
    if ((x = find(x)) == (y = find(y))) {
      return false;
    }
    --cnt;
    if (par[x] > par[y]) {
      swap(x, y);
    }
    par[x] += par[y];
    par[y] = x;
    return true;
  }
  inline int count() const { return cnt; }
  inline int count(int x) { return -par[find(x)]; }
};
int n, m, w;
vector<int> W, B;
const int MAX_N = 1000 + 10;
const int MAX_W = 1000 + 10;
UnionFind uf(MAX_N);
long long dp[MAX_N][MAX_W];
void solve() {
  vector<int> group[MAX_N];
  for (int i = (1); i < (n + 1); i++) {
    int g = uf.find(i);
    group[g].push_back(i);
  }
  int sum_w[MAX_N];
  long long sum_b[MAX_N];
  for (int i = (1); i < (n + 1); i++) {
    sum_w[i] = 0;
    sum_b[i] = 0;
  }
  for (int i = (1); i < (n + 1); i++) {
    for (auto v : group[i]) {
      sum_w[i] += W[v - 1];
      sum_b[i] += B[v - 1];
    }
  }
  for (int i = 0; i < (n + 1); i++) {
    for (int j = 0; j < (w + 1); j++) {
      dp[i + 1][j] = dp[i][j];
      if (group[i + 1].size() != 0) {
        if (j - sum_w[i + 1] >= 0) {
          dp[i + 1][j] =
              max(dp[i + 1][j], dp[i][j - sum_w[i + 1]] + sum_b[i + 1]);
        }
        for (auto v : group[i + 1]) {
          if (j - W[v - 1] >= 0) {
            dp[i + 1][j] = max(dp[i + 1][j], dp[i][j - W[v - 1]] + B[v - 1]);
          }
        }
      }
    }
  }
  cout << dp[n][w] << endl;
}
int main(int argc, char const* argv[]) {
  cin >> n >> m >> w;
  for (int i = 0; i < (n); i++) {
    int tmp;
    cin >> tmp;
    W.push_back(tmp);
  }
  for (int i = 0; i < (n); i++) {
    int tmp;
    cin >> tmp;
    B.push_back(tmp);
  }
  for (int i = 0; i < (m); i++) {
    int x, y;
    cin >> x >> y;
    uf.unite(x, y);
  }
  solve();
  return 0;
}
