#include <bits/stdc++.h>
using namespace std;
const long long PIVO = 5005;
long long dp[PIVO][PIVO];
vector<pair<long long, long long>> portals[PIVO];
vector<long long> to[PIVO];
long long a[PIVO], b[PIVO], c[PIVO];
signed main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  long long n, m, k;
  cin >> n >> m >> k;
  for (long long i = 1; i <= n; i++) {
    cin >> a[i] >> b[i] >> c[i];
  }
  for (long long i = 0; i < m; i++) {
    long long u, v;
    cin >> u >> v;
    to[v].push_back(u);
  }
  for (long long i = 1; i <= n; i++) {
    if (!to[i].empty()) {
      long long x = *max_element(to[i].begin(), to[i].end());
      portals[x].push_back({-c[i], i});
    } else
      portals[i].push_back({-c[i], i});
  }
  for (long long i = 1; i <= n; i++) {
    sort(portals[i].begin(), portals[i].end());
  }
  memset(dp, -127, sizeof dp);
  dp[0][k] = 0;
  for (long long i = 1; i <= n; i++) {
    vector<long long> pmx(portals[i].size() + 1);
    pmx[0] = 0;
    for (long long j = 1; j <= portals[i].size(); j++)
      pmx[j] = pmx[j - 1] - portals[i][j - 1].first;
    for (long long j = a[i] + b[i]; j < PIVO; j++) {
      dp[i][j] = dp[i - 1][j - b[i]];
    }
    for (long long k = 0; k < PIVO; k++) {
      for (long long j = 0; j < pmx.size(); j++) {
        if (k + j >= PIVO) continue;
        dp[i][k] = max(dp[i][k], dp[i][k + j] + pmx[j]);
      }
    }
  }
  long long ans = -1;
  for (long long i = 0; i < PIVO; i++) ans = max(ans, dp[n][i]);
  cout << ans;
}
