#include <bits/stdc++.h>
using namespace std;
long long n;
long long a[5005], b[5005], c[5005];
set<pair<long long, long long> > st[5005];
long long dp[5005][5005];
long long cnt[5005];
long long DP(long long i, long long j) {
  if (i == n + 1) return (j >= 0) ? 0 : -1;
  if (a[i] > j) return -1;
  if (dp[i][j] != -2) return dp[i][j];
  long long ans = DP(i + 1, j + b[i]);
  long long sum = 0;
  long long pcnt = 0;
  for (auto u : st[i]) {
    long long pans = DP(i + 1, j + b[i] - (++pcnt));
    if (pans == -1) {
      pcnt--;
      break;
    }
    sum -= u.first;
    pans += sum;
    ans = max(ans, pans);
  }
  return dp[i][j] = ans;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  long long d, e, f, i, j, k, m, o, x, y;
  cin >> n >> m >> k;
  for (i = 0; i < 5005; i++)
    for (j = 0; j < 5005; j++) dp[i][j] = -2;
  for (i = 1; i <= n; i++) cin >> a[i] >> b[i] >> c[i];
  for (i = 1; i <= m; i++) {
    long long u, v;
    cin >> u >> v;
    st[u].insert({-c[v], v});
  }
  for (i = 1; i <= n; i++) {
    st[i].insert({-c[i], i});
  }
  for (i = n; i >= 1; i--) {
    vector<long long> vv;
    for (auto u : st[i]) {
      if (cnt[u.second] != 0) {
        vv.push_back(u.second);
      } else {
        cnt[u.second] = 1;
      }
    }
    for (long long u : vv) {
      st[i].erase({-c[u], u});
    }
    vv.clear();
  }
  long long ans = DP(1, k);
  cout << ans << "\n";
}
