#include <bits/stdc++.h>
using namespace std;
const int MAXN = 5010;
const int MAXM = 3e5 + 10;
const int INF = 1e9 + 7;
int a[MAXN];
int b[MAXN];
int c[MAXN];
vector<pair<int, int> > portals[MAXN];
vector<pair<int, int> > real_portals[MAXN];
int reachable_by[MAXN];
int dp[MAXN][MAXN];
int main() {
  int n, m, k;
  cin >> n >> m >> k;
  for (int i = 1; i <= n; i++) {
    cin >> a[i] >> b[i] >> c[i];
  }
  for (int i = 0; i < m; i++) {
    int u, v;
    cin >> u >> v;
    portals[u].push_back(make_pair(-c[v], v));
  }
  for (int u = 1; u <= n; u++) {
    portals[u].push_back(make_pair(-c[u], u));
    sort(portals[u].begin(), portals[u].end());
    for (int i = 0; i < portals[u].size(); i++) {
      int v = portals[u][i].second;
      reachable_by[v] = u;
    }
  }
  for (int u = 1; u <= n; u++) {
    for (int i = 0; i < portals[u].size(); i++) {
      int v = portals[u][i].second;
      if (reachable_by[v] == u) {
        real_portals[u].push_back(make_pair(-c[v], v));
      }
    }
  }
  memset(dp, -1, sizeof(dp));
  dp[0][k] = 0;
  for (int i = 1; i <= n; i++) {
    for (int j = a[i]; j < MAXN; j++) {
      if (dp[i - 1][j] == -1) {
        continue;
      }
      int newj = j + b[i];
      int extra_score = 0;
      for (int k = 0; k <= real_portals[i].size(); k++) {
        if (newj - k < 0) {
          continue;
        }
        if (k > 0) {
          extra_score += (-1 * real_portals[i][k - 1].first);
        }
        dp[i][newj - k] = max(dp[i][newj - k], dp[i - 1][j] + extra_score);
      }
    }
  }
  int ans = -INF;
  for (int i = 0; i < MAXN; i++) {
    ans = max(ans, dp[n][i]);
  }
  cout << ans << endl;
}
