#include <bits/stdc++.h>
using namespace std;
vector<vector<int> > g(10000), vert(10000);
bool used[5000][5000];
void dfs(int v, int root) {
  used[root][v] = true;
  for (int j = 0; j < g[v].size(); j++) used[root][g[v][j]] = true;
}
int main() {
  ios::sync_with_stdio(0);
  int n, m, k;
  cin >> n >> m >> k;
  vector<int> a(n), b(n), c(n);
  for (int i = 0; i < n; i++) cin >> a[i] >> b[i] >> c[i];
  for (int i = 0; i < m; i++) {
    int x, y;
    cin >> x >> y;
    x--;
    y--;
    g[x].push_back(y);
  }
  int dp[n + 1][10001];
  for (int i = 0; i <= n; i++)
    for (int j = 0; j < 10000; j++) dp[i][j] = -1e9;
  for (int i = 0; i < n; i++) dfs(i, i);
  for (int i = 0; i < n; i++)
    for (int j = n - 1; j >= 0; j--)
      if (used[j][i]) {
        vert[j].push_back(c[i]);
        break;
      }
  dp[0][k] = 0;
  for (int i = 0; i < n; i++) {
    sort(vert[i].begin(), vert[i].end());
    reverse(vert[i].begin(), vert[i].end());
    int pref[vert[i].size() + 1];
    pref[0] = 0;
    for (int j = 0; j < vert[i].size(); j++) pref[j + 1] = pref[j] + vert[i][j];
    for (int j = 0; j < 10000; j++)
      if (j >= a[i]) {
        int s = j + b[i];
        for (int v = 0; v <= vert[i].size(); v++)
          if (s >= v)
            dp[i + 1][s - v] = max(dp[i + 1][s - v], dp[i][j] + pref[v]);
      }
  }
  int mx = -1;
  for (int j = 0; j < 10000; j++) mx = max(mx, dp[n][j]);
  cout << mx << endl;
}
