#include <bits/stdc++.h>
using namespace std;
const int N = 5100;
int a[N], b[N], c[N], l[N], dp[N][N];
vector<int> v[N];
int main() {
  int n, m, k;
  cin >> n >> m >> k;
  int ok = 1;
  int t = k;
  for (int i = 1; i <= n; i++) {
    cin >> a[i] >> b[i] >> c[i];
    if (t < a[i]) ok = 0;
    t += b[i];
  }
  for (int i = 1; i <= n; i++) l[i] = i;
  for (int i = 1; i <= m; i++) {
    int x, y;
    cin >> x >> y;
    l[y] = max(x, l[y]);
  }
  for (int i = 1; i <= n; i++) {
    v[l[i]].push_back(c[i]);
  }
  if (!ok) {
    cout << -1 << endl;
    return 0;
  }
  memset(dp, -1, sizeof(dp));
  dp[1][k] = 0;
  for (int i = 1; i <= n; i++) {
    for (int j = 0; j <= 5000; j++) {
      if (j < a[i]) continue;
      dp[i + 1][j + b[i]] = max(dp[i + 1][j + b[i]], dp[i][j]);
    }
    for (int k = 0; k < v[i].size(); k++)
      for (int j = 1; j <= 5000; j++) {
        if (dp[i + 1][j] == -1) continue;
        dp[i + 1][j - 1] = max(dp[i + 1][j - 1], dp[i + 1][j] + v[i][k]);
      }
  }
  int ans = 0;
  for (int i = 0; i <= 5000; i++) {
    ans = max(ans, dp[n + 1][i]);
  }
  cout << ans << endl;
}
