#include <bits/stdc++.h>
using namespace std;
const long double PI = 3.141592653589793238462643383;
long long int Ceil(int a, int b) {
  if (a % b == 0)
    return a / b;
  else
    return (a / b) + 1;
}
long long p = 1000000007;
int dp[1005], olddp[1005], wt[1005], bt[1005], n, m, w;
vector<int> v[1005];
int visit[1005] = {0};
int sw = 0, sb = 0;
void fun(int ind) {
  if (visit[ind] == 0) {
    visit[ind] = 1;
    sw += wt[ind];
    sb += bt[ind];
    for (int i = 0; i <= w; i++) {
      if (i >= wt[ind])
        dp[i] = max({dp[i], olddp[i - wt[ind]] + bt[ind], olddp[i]});
      else
        dp[i] = max({dp[i], olddp[i]});
    }
    for (int i = 0; i < v[ind].size(); i++) {
      fun(v[ind][i]);
    }
  }
}
int main() {
  cin.sync_with_stdio(0);
  cin.tie(0);
  cin.exceptions(cin.failbit);
  cin >> n >> m >> w;
  for (long long i = 0; i < (n); ++i) cin >> wt[i + 1];
  for (long long i = 0; i < (n); ++i) cin >> bt[i + 1];
  for (long long i = 0; i < (m); ++i) {
    int x, y;
    cin >> x >> y;
    v[x].push_back(y);
    v[y].push_back(x);
  }
  for (long long i = 0; i < (1005); ++i) {
    olddp[i] = dp[i] = 0;
    visit[i] = 0;
  }
  for (long long i = 1; i <= (n); ++i) {
    if (visit[i] == 0) {
      sw = 0;
      sb = 0;
      for (long long j = 0; j < (1005); ++j) {
        olddp[j] = dp[j];
      }
      for (long long j = 0; j < (1005); ++j) dp[j] = 0;
      fun(i);
      for (int i = 0; i <= w; i++) {
        if (i >= sw)
          dp[i] = max({dp[i], olddp[i - sw] + sb, olddp[i]});
        else
          dp[i] = max({dp[i], olddp[i]});
      }
    }
  }
  cout << dp[w];
  return 0;
}
