#include <bits/stdc++.h>
using namespace std;
int w[1010], b[1010], pre[1010], vis[1010], w1[1010], b1[1010];
long long dp[1010];
vector<int> a[1010];
int find(int x) {
  if (pre[x] == x) return x;
  return pre[x] = find(pre[x]);
}
int main() {
  int n, m, p, x, y;
  while (~scanf("%d%d%d", &n, &p, &m)) {
    memset(vis, 0, sizeof(vis));
    memset(w1, 0, sizeof(w1));
    memset(b1, 0, sizeof(b1));
    memset(dp, 0, sizeof(dp));
    for (int i = 1; i <= n; i++) pre[i] = i;
    for (int i = 1; i <= n; i++) scanf("%d", &w[i]);
    for (int i = 1; i <= n; i++) scanf("%d", &b[i]);
    while (p--) {
      scanf("%d%d", &x, &y);
      int xx = find(x);
      int yy = find(y);
      if (xx != yy) pre[yy] = xx;
    }
    for (int i = 1; i <= n; i++) find(i);
    int sum1 = 0, sum2, sum3;
    for (int i = 1; i <= n; i++) {
      sum2 = 0;
      sum3 = 0;
      if (!vis[i]) {
        for (int j = 1; j <= n; j++) {
          if (pre[j] == i) {
            a[sum1].push_back(j);
            vis[j] = 1;
            sum2 += w[j];
            sum3 += b[j];
          }
        }
      }
      w1[sum1] = sum2;
      b1[sum1] = sum3;
      sum1++;
    }
    for (int i = 0; i < sum1; i++) {
      for (int j = m; j >= 0; j--) {
        if (j >= w1[i]) {
          dp[j] = max(dp[j], dp[j - w1[i]] + b1[i]);
        }
        for (int k = 0; k < a[i].size(); k++) {
          x = a[i][k];
          if (j >= w[x]) {
            dp[j] = max(dp[j], dp[j - w[x]] + b[x]);
          }
        }
      }
    }
    for (int i = 0; i < sum1; i++) a[i].clear();
    printf("%d\n", dp[m]);
  }
  return 0;
}
