#include <bits/stdc++.h>
using namespace std;
const long long mod = 998244353;
const int N = 5e3 + 5;
const int inf = 2e9;
const long long linf = 4e18;
int a[N], b[N], c[N], dp[N][N], mx[N];
vector<int> adj[N];
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  cerr.tie(0);
  int n, m, k;
  cin >> n >> m >> k;
  for (int i = 1; i <= n; i++) {
    cin >> a[i] >> b[i] >> c[i];
    mx[i] = i;
  }
  for (int i = 0; i < m; i++) {
    int u, v;
    cin >> u >> v;
    mx[v] = max(mx[v], u);
  }
  for (int i = 1; i <= n; i++) adj[mx[i]].push_back(c[i]);
  for (int i = 1; i <= n; i++) {
    sort(adj[i].rbegin(), adj[i].rend());
    for (int j = 1; j < adj[i].size(); j++) adj[i][j] += adj[i][j - 1];
  }
  memset(dp, -1, sizeof(dp));
  dp[0][k] = 0;
  for (int i = 1; i <= n; i++) {
    for (int j = 0; j < N; j++) {
      if (j >= b[i] && j - b[i] >= a[i] && ~dp[i - 1][j - b[i]])
        dp[i][j] = dp[i - 1][j - b[i]];
      for (int ko = 0; ko < adj[i].size(); ko++) {
        int ne = j - b[i] + ko + 1;
        if (ne >= 0 && ne >= a[i] && ne < N && ~dp[i - 1][ne])
          dp[i][j] = max(dp[i][j], dp[i - 1][ne] + adj[i][ko]);
      }
    }
  }
  int ans = -1;
  for (int i = 0; i < N; i++) ans = max(ans, dp[n][i]);
  cout << ans;
  return 0;
}
