#include <bits/stdc++.h>
using namespace std;
namespace IO {
char buf[1 << 21], *p1 = buf, *p2 = buf;
char getch() {
  return p1 == p2 && (p2 = (p1 = buf) + fread(buf, 1, 1 << 21, stdin), p1 == p2)
             ? EOF
             : *p1++;
}
template <typename T>
void read(T &x) {
  int fl = 1;
  char ch = getch();
  x = 0;
  while (ch > '9' || ch < '0') {
    if (ch == '-') fl = -1;
    ch = getch();
  }
  while (ch <= '9' && ch >= '0') {
    x = x * 10 + ch - 48;
    ch = getch();
  }
  x *= fl;
}
template <typename T, typename... Args>
void read(T &x, Args &...args) {
  read(x);
  read(args...);
}
}  // namespace IO
using namespace IO;
int n, m, K, a[5010], b[5010], c[5010];
int mx[5010];
vector<int> V[5010];
int f[5010][5010];
int main() {
  read(n, m, K);
  for (int i = 1; i <= n; i++) read(a[i], b[i], c[i]);
  for (int i = 1; i <= n; i++) mx[i] = i;
  for (int i = 1; i <= m; i++) {
    int u, v;
    read(u, v);
    mx[v] = max(mx[v], u);
  }
  for (int i = 1; i <= n; i++) V[mx[i]].push_back(i);
  memset(f, 0xcf, sizeof(f));
  for (int i = 0; i <= K; i++) f[0][i] = 0;
  for (int u = 1; u <= n; u++) {
    for (int i = a[u]; i <= 5000 - b[i]; i++) f[u][i + b[u]] = f[u - 1][i];
    for (unsigned int i = 0; i < V[u].size(); i++) {
      int v = V[u][i];
      for (int j = 0; j < 5000; j++) f[u][j] = max(f[u][j], f[u][j + 1] + c[v]);
    }
  }
  int ans = -1;
  for (int i = 0; i <= 5000; i++) ans = max(ans, f[n][i]);
  printf("%d", ans);
  return 0;
}
