#include <bits/stdc++.h>
using namespace std;
const int N = 5e3 + 5, inf = 1e9 + 5;
int a[N], b[N], c[N], d[N];
int dp[N][N];
vector<int> edge[N];
bool cmp(const int &u, const int &v) { return c[u] > c[v]; }
int main() {
  int n, m, k;
  scanf("%d %d %d", &n, &m, &k);
  for (int i = 1; i < n + 1; ++i) scanf("%d %d %d", &a[i], &b[i], &c[i]);
  int u, v;
  for (int i = 1; i < n + 1; ++i) d[i] = i;
  for (int i = 0; i < m; ++i) {
    scanf("%d %d", &u, &v);
    d[v] = max(d[v], u);
  }
  for (int i = 1; i < n + 1; ++i) {
    edge[d[i]].push_back(i);
  }
  for (int i = 1; i < n + 1; ++i) sort(edge[i].begin(), edge[i].end(), cmp);
  memset(dp, -1, sizeof(dp));
  dp[0][k] = 0;
  for (int i = 1; i < n + 1; ++i) {
    for (int j = a[i]; j < 5001; ++j) {
      if (dp[i - 1][j] == -1) continue;
      dp[i][j + b[i]] = dp[i - 1][j];
    }
    for (auto v : edge[i]) {
      for (int j = 1; j < 5001; ++j) {
        if (dp[i][j] == -1) continue;
        dp[i][j - 1] = max(dp[i][j - 1], dp[i][j] + c[v]);
      }
    }
  }
  int mx = -1;
  for (int i = 0; i < 5001; ++i) mx = max(mx, dp[n][i]);
  printf("%d\n", mx);
  return 0;
}
