#include <bits/stdc++.h>
using namespace std;
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
const long long int mod = 1000000007;
const long long int inf = 0x3f3f3f3f3f3f3f3fLL;
const double eps = 1e-9;
const double PI = acos(-1);
long long int i, j, k;
void solve(void);
inline bool equal(double a, double b) { return fabs(a - b) < eps; }
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout << fixed << setprecision(10);
  int t = 1;
  while (t--) solve();
  ;
  ;
  return 0;
}
long long int n, m, a[5005], b[5005], c[5005], DP[5005][5005], par[5005];
vector<long long int> node[5005], nodesum[5005];
long long int calc(long long int x, long long int y) {
  if (x == n + 1) return 0;
  if (y < a[x]) return -1;
  if (DP[x][y] != -2) return DP[x][y];
  long long int i, val = -1;
  val = calc(x + 1, y + b[x]);
  for (i = 0; i <= (int)nodesum[x].size() - 1; ++i) {
    long long int t = -1;
    if (y + b[x] >= i + 1) t = calc(x + 1, y + b[x] - i - 1);
    if (t != -1) t += nodesum[x][i];
    val = ((val) > (t) ? (val) : (t));
  }
  return DP[x][y] = val;
}
void solve() {
  cin >> n >> m >> k;
  for (i = 1; i <= n; ++i) cin >> a[i] >> b[i] >> c[i];
  for (i = 0; i <= 5005 - 1; ++i)
    for (j = 0; j <= 5005 - 1; ++j) DP[i][j] = -2;
  map<long long int, vector<long long int> > v;
  while (m--) {
    int x, y;
    cin >> x >> y;
    v[y].emplace_back(x);
  }
  for (i = 1; i <= n; ++i) sort(v[i].begin(), v[i].end());
  for (i = 1; i <= n; ++i)
    if ((int)v[i].size()) {
      par[i] = v[i].back();
      node[v[i].back()].emplace_back(i);
    }
  for (i = 1; i <= n; ++i)
    if (par[i] == 0) node[i].emplace_back(i);
  for (i = 1; i <= n; ++i)
    for (auto it : node[i]) nodesum[i].emplace_back(c[it]);
  for (i = 1; i <= n; ++i)
    sort(nodesum[i].begin(), nodesum[i].end(), greater<int>());
  for (i = 1; i <= n; ++i)
    for (j = 1; j <= (int)nodesum[i].size() - 1; ++j)
      nodesum[i][j] += nodesum[i][j - 1];
  if (calc(1, k) < 0) {
    cout << "-1\n";
    return;
  }
  cout << calc(1, k) << '\n';
}
