#include <bits/stdc++.h>
using namespace std;
const int maxn = 1010;
pair<int, int> a[maxn];
int f[maxn];
vector<int> b[maxn];
int dp[maxn];
int tot, mp[maxn], sum[maxn], val[maxn];
int get(int x) {
  if (x == f[x]) return x;
  return f[x] = get(f[x]);
}
int main() {
  int n, m, w;
  scanf("%d%d%d", &n, &m, &w);
  for (int i = 1; i <= n; i++) scanf("%d", &a[i].first);
  for (int i = 1; i <= n; i++) scanf("%d", &a[i].second);
  for (int i = 1; i <= n; i++) f[i] = i;
  for (int i = 1; i <= m; i++) {
    int x, y;
    scanf("%d%d", &x, &y);
    int p1 = get(x), p2 = get(y);
    if (p1 == p2) continue;
    f[p1] = p2;
  }
  for (int i = 1; i <= n; i++) {
    if (f[i] == i) mp[i] = ++tot;
  }
  for (int i = 1; i <= n; i++) {
    int x = get(i);
    b[mp[x]].push_back(i);
    sum[mp[x]] += a[i].first;
    val[mp[x]] += a[i].second;
  }
  memset(dp, 0xcf, sizeof(dp));
  dp[0] = 0;
  for (int i = 1; i <= tot; i++) {
    for (int j = w; j >= 0; j--) {
      if (j >= sum[i]) dp[j] = max(dp[j], dp[j - sum[i]] + val[i]);
      for (int k = 0; k < b[i].size(); k++) {
        pair<int, int> tmp = a[b[i][k]];
        if (j >= tmp.first) dp[j] = max(dp[j], dp[j - tmp.first] + tmp.second);
      }
    }
  }
  int ans = 0;
  for (int i = 1; i <= w; i++) ans = max(ans, dp[i]);
  printf("%d\n", ans);
}
