#include <bits/stdc++.h>
using namespace std;
long long n, m, k, x, y, tp, ans;
long long a[110000], b[110000], c[110000], t[110000], f[5100][5100];
pair<long long, long long> p[110000];
signed main() {
  cin >> n >> m >> k;
  for (long long i = 1; i <= n; i++)
    scanf("%d%d%d", &a[i], &b[i], &c[i]), t[i] = i;
  while (m--) scanf("%d%d", &x, &y), t[y] = max(t[y], x);
  for (long long i = 1; i <= n; i++) p[i] = make_pair(t[i], c[i]);
  sort(p + 1, p + n + 1);
  for (long long i = 0; i <= k; i++) f[0][i] = 0;
  for (long long i = k + 1; i <= 5000; i++) f[0][i] = -2e9;
  tp = 1;
  for (long long i = 1; i <= n; i++) {
    for (long long j = 0; j <= 5000; j++) f[i][j] = -2e9;
    for (long long j = a[i]; j <= 5000; j++)
      f[i][j + b[i]] = max(f[i][j + b[i]], f[i - 1][j]);
    while (tp <= n && p[tp].first == i) {
      for (long long t = 0; t < 5000; t++)
        f[i][t] = max(f[i][t], f[i][t + 1] + p[tp].second);
      tp++;
    }
  }
  ans = -1;
  for (long long i = 0; i <= 5000; i++) ans = max(ans, f[n][i]);
  cout << ans;
  return 0;
}
