#include <bits/stdc++.h>
using namespace std;
inline int min(int a, int b) { return a < b ? a : b; }
inline int max(int a, int b) { return a > b ? a : b; }
int n, m, wm;
int w[1010], b[1010];
vector<int> ne[1010];
bool used[1010];
vector<int> groups[1010];
int groups_sz;
int f[1010][1010];
void dfs(int cur) {
  if (used[cur]) return;
  used[cur] = true;
  groups[groups_sz].push_back(cur);
  for (vector<int>::iterator i = ne[cur].begin(); i != ne[cur].end(); ++i) {
    dfs(*i);
  }
}
int main() {
  ios::sync_with_stdio(false);
  cin >> n >> m >> wm;
  for (int i = 1; i <= n; ++i) cin >> w[i];
  for (int i = 1; i <= n; ++i) cin >> b[i];
  for (int i = 1; i <= m; ++i) {
    int x, y;
    cin >> x >> y;
    ne[x].push_back(y);
    ne[y].push_back(x);
  }
  for (int i = 1; i <= n; ++i) {
    if (!used[i]) {
      ++groups_sz;
      dfs(i);
    }
  }
  for (int i = 1; i <= groups_sz; ++i) {
    f[i][0] = 0;
    for (int j = 1; j <= wm; ++j) {
      f[i][j] = f[i - 1][j];
      int group_w = 0, group_b = 0;
      for (vector<int>::iterator k = groups[i].begin(); k != groups[i].end();
           ++k) {
        group_w += w[*k];
        group_b += b[*k];
        if (j >= w[*k]) f[i][j] = max(f[i][j], f[i - 1][j - w[*k]] + b[*k]);
      }
      if (j >= group_w) f[i][j] = max(f[i][j], f[i - 1][j - group_w] + group_b);
    }
  }
  cout << f[groups_sz][wm] << '\n';
  return 0;
}
