#include <bits/stdc++.h>
int n, m, k, f[5050][5050], to[5050], a[5050], b[5050], c[5050];
std::vector<int> road[5050];
int main() {
  scanf("%d%d%d", &n, &m, &k);
  for (int i = 1; i <= n; i++) scanf("%d%d%d", &a[i], &b[i], &c[i]);
  for (int i = 1; i <= n; i++) to[i] = i;
  for (int i = 1; i <= m; i++) {
    int x, y;
    scanf("%d%d", &x, &y);
    to[y] = std::max(to[y], x);
  }
  for (int i = 1; i <= n; i++) {
    road[to[i]].push_back(i);
  }
  for (int i = 0; i <= n; i++)
    for (int j = 0; j <= 5049; j++) f[i][j] = -0x3f3f3f3f;
  for (int i = 0; i <= k; i++) f[0][k] = 0;
  for (int i = 1; i <= n; i++) {
    for (int j = a[i]; j <= 5000; j++)
      f[i][j + b[i]] = std::max(f[i - 1][j], f[i][j + b[i]]);
    for (int j = 0; j < road[i].size(); j++) {
      for (int l = a[i + 1]; l <= 5000; l++)
        f[i][l] = std::max(f[i][l], f[i][l + 1] + c[road[i][j]]);
    }
  }
  int ans = -1;
  for (int i = 0; i <= 5000; i++) ans = std::max(ans, f[n][i]);
  printf("%d\n", ans);
  return 0;
}
