#include <bits/stdc++.h>
using namespace std;
const int maxn = 1100;
vector<int> v[maxn];
vector<int> q[maxn];
bool mark[maxn];
pair<long long, long long> a[maxn];
pair<long long, long long> b[maxn];
long long dp[maxn][maxn];
long long n, m, w;
void dfs(long long i, long long j) {
  q[j].push_back(i);
  mark[i] = 1;
  b[j].second += a[i].second;
  b[j].first += a[i].first;
  for (long long y = 0; y < v[i].size(); y++) {
    long long x = v[i][y];
    if (!mark[x]) dfs(x, j);
  }
}
int main() {
  cin >> n >> m >> w;
  for (long long y = 1; y <= n; y++) cin >> a[y].first;
  for (long long y = 1; y <= n; y++) cin >> a[y].second;
  while (m) {
    long long i, j;
    cin >> i >> j;
    v[i].push_back(j);
    v[j].push_back(i);
    m--;
  }
  for (long long y = 1; y <= n; y++) {
    if (!mark[y]) {
      dfs(y, y);
    }
  }
  for (long long y = 1; y <= n; y++) {
    for (long long j = 1; j <= w; j++) {
      dp[y][j] = max(dp[y - 1][j], dp[y][j - 1]);
      if (j - b[y].first >= 0)
        dp[y][j] = max(dp[y][j], dp[y - 1][j - b[y].first] + b[y].second);
      for (long long i = 0; i < q[y].size(); i++) {
        long long x = q[y][i];
        if (j - a[x].first >= 0)
          dp[y][j] = max(dp[y][j], dp[y - 1][j - a[x].first] + a[x].second);
      }
    }
  }
  cout << dp[n][w];
}
