#include <bits/stdc++.h>
using namespace std;
constexpr long long INF = 2e18;
constexpr long long MOD = 1e9 + 7;
constexpr long long MAXN = 5e3 + 3;
vector<long long> adj1[MAXN];
vector<pair<long long, long long> > adj2[MAXN];
vector<long long> vis;
long long max_val(long long u) {
  vis[u] = true;
  long long ret = u;
  for (long long v : adj1[u]) {
    ret = max(ret, v);
  }
  return ret;
}
vector<long long> a, b, c;
long long n;
long long dp[MAXN][MAXN];
long long f(long long idx, long long sold) {
  if (sold < 0) {
    return -INF;
  }
  if (idx == n) {
    return 0;
  }
  if (a[idx] > sold) {
    return -INF;
  }
  long long &ret = dp[idx][sold];
  if (~ret) {
    return ret;
  }
  sold += b[idx];
  ret = f(idx + 1, sold);
  {
    long long i = 1;
    long long sum = 0;
    for (auto [w, v] : adj2[idx]) {
      sum += w;
      ret = max(ret, sum + f(idx + 1, sold - i));
      ++i;
    }
  }
  return ret;
}
void solve() {
  memset(dp, -1, sizeof dp);
  cin >> n;
  long long m, k;
  cin >> m >> k;
  a.resize(n);
  b.resize(n);
  c.resize(n);
  for (long long i = 0; i < n; ++i) {
    cin >> a[i] >> b[i] >> c[i];
  }
  while (m--) {
    long long u, v;
    cin >> u >> v;
    --u, --v;
    adj1[v].emplace_back(u);
  }
  for (long long i = 0; i < n; ++i) {
    vis = vector<long long>(n, 0);
    long long val = max_val(i);
    adj2[val].emplace_back(c[i], i);
  }
  for (long long i = 0; i < n; ++i) {
    sort(adj2[i].begin(), adj2[i].end(),
         greater<pair<long long, long long> >());
  }
  cout << max(-1ll, f(0, k)) << '\n';
}
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long t = 1;
  while (t--) solve();
}
