#include <bits/stdc++.h>
using namespace std;
template <typename T, typename U>
ostream& operator<<(ostream& os, const pair<T, U>& _p) {
  return os << "(" << _p.first << "," << _p.second << ")";
}
template <typename T>
ostream& operator<<(ostream& os, const vector<T>& _V) {
  bool f = true;
  os << "[";
  for (auto v : _V) {
    os << (f ? "" : ",") << v;
    f = false;
  }
  return os << "]";
}
template <typename T>
ostream& operator<<(ostream& os, const set<T>& _S) {
  bool f = true;
  os << "(";
  for (auto s : _S) {
    os << (f ? "" : ",") << s;
    f = false;
  }
  return os << ")";
}
template <typename T, typename U>
ostream& operator<<(ostream& os, const map<T, U>& _M) {
  return os << set<pair<T, U>>(_M.begin(), _M.end());
}
template <class TH>
void _dbg(const char* sdbg, TH h) {
  cerr << sdbg << '=' << h << endl;
}
template <class TH, class... TA>
void _dbg(const char* sdbg, TH h, TA... a) {
  while (*sdbg != ',') cerr << *sdbg++;
  cerr << '=' << h << ',';
  _dbg(sdbg + 1, a...);
}
const signed long long INF = 1000000100;
const long double EPS = 1e-9;
void read_data() {}
void solve() {}
int A[1010][1010];
vector<int> G[1010];
int Rep[1010];
int W[1010], B[1010];
void Union(int a, int b) {
  if (Rep[a] == Rep[b]) return;
  a = Rep[a];
  b = Rep[b];
  if (int(G[a].size()) < int(G[b].size())) swap(a, b);
  for (int g : G[b]) {
    G[a].push_back(g);
    Rep[g] = a;
  }
}
int main() {
  int n, m, w;
  scanf("%d%d%d", &n, &m, &w);
  for (int(i) = (1); (i) <= (n); (i)++) scanf("%d", &W[i]);
  for (int(i) = (1); (i) <= (n); (i)++) scanf("%d", &B[i]);
  for (int(i) = (1); (i) <= (n); (i)++) {
    G[i].push_back(i);
    Rep[i] = i;
  }
  for (int(i) = (1); (i) <= (m); (i)++) {
    int a, b;
    scanf("%d%d", &a, &b);
    Union(a, b);
  }
  set<int> S;
  for (int(i) = (1); (i) <= (n); (i)++) S.insert(Rep[i]);
  for (int(i) = (0); (i) <= (1000); (i)++)
    for (int(j) = (0); (j) <= (1000); (j)++) A[i][j] = -INF;
  A[0][0] = 0;
  int pp = 0;
  for (int s : S) {
    int sw = 0, sb = 0;
    for (int g : G[s]) {
      sw += W[g];
      sb += B[g];
      for (int(i) = (0); (i) <= (w - W[g]); (i)++)
        A[pp + 1][i + W[g]] = max(A[pp + 1][i + W[g]], A[pp][i] + B[g]);
    }
    for (int(i) = (0); (i) <= (w - sw); (i)++)
      A[pp + 1][i + sw] = max(A[pp + 1][i + sw], A[pp][i] + sb);
    for (int(i) = (0); (i) <= (w); (i)++)
      A[pp + 1][i] = max(A[pp + 1][i], A[pp][i]);
    pp++;
  }
  int ans = 0;
  for (int(i) = (0); (i) <= (w); (i)++) ans = max(ans, A[pp][i]);
  printf("%d\n", ans);
}
