#include <bits/stdc++.h>
using namespace std;
const int N = 1005;
int a[N], b[N];
int pre[N];
vector<int> ans[N];
int mark[N];
int dp[N];
int find(int x) {
  int r = x;
  while (pre[r] != r) r = pre[r];
  int i, j;
  i = x;
  while (pre[i] != r) {
    j = pre[i];
    pre[i] = r;
    i = j;
  }
  return r;
}
void mx(int u, int v) {
  int fx = find(u);
  int fy = find(v);
  if (fx != fy) pre[fx] = fy;
}
int main() {
  int n, m, w;
  scanf("%d%d%d", &n, &m, &w);
  for (int i = 1; i <= n; i++) {
    scanf("%d", &a[i]);
    pre[i] = i;
  }
  for (int i = 1; i <= n; i++) {
    scanf("%d", &b[i]);
  }
  while (m--) {
    int u, v;
    scanf("%d%d", &u, &v);
    mx(u, v);
  }
  int cnt = 0;
  for (int i = 1; i <= n; i++) {
    int fx = find(i);
    if (!mark[fx]) {
      mark[fx] = ++cnt;
    }
    ans[mark[fx]].push_back(i);
  }
  for (int i = 1; i <= cnt; i++) {
    for (int j = w; j >= 0; j--) {
      int sum = 0, q = 0;
      for (int k = 0; k < (int)ans[i].size(); k++) {
        int x = ans[i][k];
        sum += a[x];
        q += b[x];
        if (a[x] > j) continue;
        dp[j] = max(dp[j], dp[j - a[x]] + b[x]);
      }
      if (sum <= j) {
        dp[j] = max(dp[j], dp[j - sum] + q);
      }
    }
  }
  printf("%d\n", dp[w]);
}
