#include <bits/stdc++.h>
using namespace std;
const int MAXN = 5005;
const long long INF = (long long)(1e8);
long long N;
long long a[MAXN], b[MAXN], c[MAXN];
vector<pair<long long, long long>> choice[MAXN];
int dp[MAXN][MAXN];
long long rec(long long ptr, long long have) {
  if (ptr > N)
    return 0;
  else if (have < a[ptr])
    return -INF;
  else if (dp[ptr][have] != -1)
    return dp[ptr][have];
  long long left = have + b[ptr];
  long long ans = rec(ptr + 1, left), val = 0;
  for (auto it : choice[ptr]) {
    if (left == 0) break;
    val += it.first;
    left--;
    ans = max(ans, val + rec(ptr + 1, left));
  }
  return dp[ptr][have] = ans;
}
int main() {
  memset(dp, -1, sizeof dp);
  long long n, m, k;
  cin >> n >> m >> k;
  N = n;
  for (long long i = (long long)(1); i <= (long long)(n); i++)
    cin >> a[i] >> b[i] >> c[i];
  map<long long, long long> g;
  for (long long i = (long long)(1); i <= (long long)(m); i++) {
    long long u, v;
    cin >> u >> v;
    g[v] = max(g[v], u);
  }
  for (long long i = (long long)(1); i <= (long long)(n); i++) {
    if (g.find(i) == g.end())
      choice[i].push_back({c[i], i});
    else
      choice[g[i]].push_back({c[i], i});
  }
  for (long long i = (long long)(1); i <= (long long)(n); i++)
    sort(choice[i].rbegin(), choice[i].rend());
  long long val = rec(1, k);
  if (val < 0)
    cout << -1;
  else
    cout << val;
}
