#include <bits/stdc++.h>
using namespace std;
const int N = 5e3 + 100;
struct node {
  int a, b, c;
} p[N];
int nex[N];
vector<int> pre[N];
int dp[N][N];
int main() {
  int n, m, k;
  scanf("%d %d %d", &n, &m, &k);
  int sum = k;
  for (int i = 1; i <= n; ++i)
    scanf("%d %d %d", &p[i].a, &p[i].b, &p[i].c), sum += p[i].b;
  for (int i = 1; i <= n; ++i) nex[i] = i;
  for (int i = 1; i <= m; ++i) {
    int u, v;
    scanf("%d %d", &u, &v);
    nex[v] = max(nex[v], u);
  }
  for (int i = 1; i <= n; ++i) {
    pre[nex[i]].push_back(p[i].c);
  }
  memset(dp, -0x3f3f3f3f, sizeof(dp));
  dp[1][k] = 0;
  for (int i = 1; i <= n; ++i) {
    for (int j = p[i].a; j <= 5000; ++j) {
      int nj = j + p[i].b;
      if (dp[i][j] >= 0) dp[i + 1][nj] = max(dp[i + 1][nj], dp[i][j]);
    }
    for (int k = 0; k < pre[i].size(); ++k) {
      int x = pre[i][k];
      for (int j = 0; j <= 5000; ++j) {
        dp[i + 1][j] = max(dp[i + 1][j], dp[i + 1][j + 1] + x);
      }
    }
  }
  int ans = -1;
  for (int i = 0; i <= sum; ++i) ans = max(ans, dp[n + 1][i]);
  printf("%d", ans);
  return 0;
}
