#include <bits/stdc++.h>
using namespace std;
int fa[1005];
int fi(int x) { return fa[x] == x ? x : fa[x] = fi(fa[x]); }
void Union(int x, int y) {
  int p1 = fi(x), p2 = fi(y);
  if (p1 == p2) return;
  fa[p1] = p2;
}
long long dp[2][1005], a[1005], b[1005];
int vis[1005];
vector<int> v[1005];
int main() {
  int now = 0, pre = 1;
  int n, m, w;
  cin >> n >> m >> w;
  for (int i = 1; i <= n; i++) fa[i] = i;
  for (int i = 1; i <= n; i++) cin >> a[i];
  for (int i = 1; i <= n; i++) cin >> b[i];
  for (int i = 0; i < m; i++) {
    int x, y;
    cin >> x >> y;
    Union(x, y);
  }
  for (int i = 1; i <= n; i++) {
    v[fi(i)].push_back(i);
  }
  for (int i = 1; i <= n; i++) {
    if (vis[fi(i)] == 1) continue;
    vis[fi(i)] = 1;
    long long sumw = 0, sumb = 0;
    for (auto j : v[fi(i)]) {
      sumw += a[j];
      sumb += b[j];
      for (int k = 0; k <= w; k++) {
        dp[now][k] = max(dp[now][k], dp[pre][k]);
        if (k < a[j]) continue;
        dp[now][k] = max(dp[now][k], max(dp[pre][k], dp[pre][k - a[j]] + b[j]));
      }
    }
    for (int j = 0; j <= w; j++) {
      if (j < sumw) continue;
      dp[now][j] = max(dp[now][j], max(dp[pre][j], dp[pre][j - sumw] + sumb));
    }
    if (fi(3) == fi(i)) {
    }
    swap(now, pre);
    memset(dp[now], 0, sizeof(dp[now]));
  }
  long long res = 0;
  for (int i = 1; i <= w; i++) res = max(res, dp[pre][i]);
  cout << res << endl;
}
