#include <bits/stdc++.h>
using namespace std;
const int N = 1010;
int n, m, w;
long long a[N], b[N];
int vis[N];
long long peso[N];
long long beleza[N];
vector<long long> g[N];
vector<long long> group[N];
int cnt = 1;
void dfs(int x, int atGroup) {
  peso[atGroup] += a[x];
  beleza[atGroup] += b[x];
  vis[x] = atGroup;
  group[atGroup].push_back(x);
  for (int i = 0; i < g[x].size(); ++i)
    if (vis[g[x][i]] == 0) dfs(g[x][i], atGroup);
}
long long pd[N][N];
long long func(int pos, int lol) {
  if (pos == cnt) return 0;
  if (pd[pos][lol] != -1) return pd[pos][lol];
  long long ret = func(pos + 1, lol);
  if (lol >= peso[pos]) {
    ret = max(ret, beleza[pos] + func(pos + 1, lol - peso[pos]));
  }
  for (int i = 0; i < group[pos].size(); ++i) {
    int x = group[pos][i];
    if (a[x] <= lol) ret = max(ret, b[x] + func(pos + 1, lol - a[x]));
  }
  return pd[pos][lol] = ret;
}
int main() {
  scanf("%d %d %d", &n, &m, &w);
  for (int i = 0; i < n; ++i) scanf("%lld", a + i);
  for (int i = 0; i < n; ++i) scanf("%lld", b + i);
  for (int i = 0; i < m; ++i) {
    int x, y;
    scanf("%d %d", &x, &y);
    x--;
    y--;
    g[x].push_back(y);
    g[y].push_back(x);
  }
  for (int i = 0; i < n; ++i) {
    if (vis[i] == 0) {
      dfs(i, cnt++);
    }
  }
  memset(pd, -1, sizeof pd);
  printf("%lld\n", func(1, w));
  return 0;
}
