#include <bits/stdc++.h>
using namespace std;
const int MAXN = 5011;
int numA[MAXN];
int numB[MAXN];
int numC[MAXN];
int numK[MAXN];
int DP[MAXN][MAXN];
int latest[MAXN];
int main() {
  int n, m, k;
  while (~scanf("%d%d%d", &n, &m, &k)) {
    for (int i = 0; i < n; i++) scanf("%d%d%d", &numA[i], &numB[i], &numC[i]);
    for (int i = 0; i < n; i++) latest[i] = i;
    int u, v;
    for (int i = 0; i < m; i++) {
      scanf("%d%d", &u, &v);
      latest[v - 1] = max(latest[v - 1], u - 1);
    }
    for (int i = 0; i < MAXN; i++)
      for (int j = 0; j < MAXN; j++) DP[i][j] = -1e9;
    DP[0][k] = 0;
    for (int i = 0; i < n; i++) {
      for (int j = numA[i]; j < MAXN; j++) {
        if (DP[i][j] >= 0)
          DP[i + 1][j + numB[i]] = max(DP[i + 1][j + numB[i]], DP[i][j]);
      }
      for (int j = 0; j <= i; j++) {
        if (latest[j] == i) {
          for (int k = 1; k < MAXN; k++) {
            if (DP[i + 1][k] >= 0) {
              DP[i + 1][k - 1] = max(DP[i + 1][k - 1], DP[i + 1][k] + numC[j]);
            }
          }
        }
      }
    }
    int ans1 = -1;
    for (int i = 0; i < MAXN; i++) ans1 = max(ans1, DP[n][i]);
    printf("%d\n", ans1);
  }
  return 0;
}
