#include <bits/stdc++.h>
using namespace std;
inline void Max(int &a, int b) { (a < b) && (a = b); }
int f[5005][5005], n, m, k, a[5005], b[5005], c[5005], mx[5005];
vector<int> e[5005];
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 x, y, i = 1; i <= m; ++i) {
    scanf("%d%d", &x, &y);
    if (x > y) swap(x, y);
    mx[x] = max(mx[x], y);
  }
  for (int i = 1; i <= n; ++i) {
    if (!mx[i]) mx[i] = i;
    e[mx[i]].push_back(i);
  }
  memset(f, 0xcf, sizeof f);
  f[0][k] = 0;
  for (int i = 1; i <= n; ++i) {
    for (int j = a[i]; j <= 5000; ++j) {
      if (f[i - 1][j] == 0xcfcfcfcf) continue;
      f[i][j + b[i]] = f[i - 1][j];
    }
    for (int j = 0; j < e[i].size(); ++j) {
      for (int jj = 0; jj < 5000; ++jj)
        Max(f[i][jj], f[i][jj + 1] + c[e[i][j]]);
    }
  }
  int ans = -1;
  for (int i = 0; i <= 5000; ++i) Max(ans, f[n][i]);
  printf("%d", ans);
  return 0;
}
