#include <bits/stdc++.h>
using namespace std;
vector<pair<pair<long long, long long>, long long> > A;
signed main() {
  long long n, m, k;
  cin >> n >> m >> k;
  A.resize(n);
  for (long long i = 0; i < n; i++) {
    cin >> A[i].first.first >> A[i].first.second >> A[i].second;
  }
  vector<long long> right(n);
  for (long long i = 0; i < n; i++) {
    right[i] = i;
  }
  vector<vector<long long> > g(n);
  for (long long i = 0; i < m; i++) {
    long long x, y;
    cin >> x >> y;
    right[y - 1] = max(right[y - 1], x - 1);
  }
  for (long long i = 0; i < n; i++) {
    g[right[i]].push_back(i);
  }
  vector<long long> dp(n + 1, 0);
  long long sum = k;
  vector<long long> dp1(n + 1);
  long long cnt1 = 0;
  for (long long i = 0; i < n; i++) {
    if (sum < A[i].first.first) {
      cout << -1;
      return 0;
    } else {
      sum += A[i].first.second;
      if (i != n - 1) {
        if (sum < A[i + 1].first.first) {
          cout << -1;
          return 0;
        }
        for (long long j = 0; j < g[i].size(); j++) {
          for (long long cnt = 0; cnt <= n; cnt++) {
            dp1[cnt] = dp[cnt];
          }
          for (long long cnt = 0;
               cnt < min(min(n, cnt1 + 1), sum - A[i + 1].first.first); cnt++) {
            dp1[cnt + 1] = max(dp1[cnt + 1], dp[cnt] + A[g[i][j]].second);
          }
          for (long long cnt = 0; cnt <= min(n, cnt1 + 1); cnt++) {
            dp[cnt] = dp1[cnt];
          }
          for (long long cnt =
                   min(min(cnt1 + 1, n), sum - A[i + 1].first.first) + 1;
               cnt <= n; cnt++) {
            dp[cnt] = 0;
          }
          cnt1++;
        }
        for (long long cnt =
                 min(min(cnt1 + 1, n), sum - A[i + 1].first.first) + 1;
             cnt <= n; cnt++) {
          dp[cnt] = 0;
        }
      } else {
        for (long long j = 0; j < g[i].size(); j++) {
          for (long long cnt = 0; cnt <= n; cnt++) {
            dp1[cnt] = dp[cnt];
          }
          for (long long cnt = 0; cnt < min(min(n, cnt1 + 1), sum); cnt++) {
            dp1[cnt + 1] = max(dp1[cnt + 1], dp[cnt] + A[g[i][j]].second);
          }
          for (long long cnt = 0; cnt <= min(min(n, cnt1 + 1), sum); cnt++) {
            dp[cnt] = dp1[cnt];
          }
          for (long long cnt = min(min(n, cnt1 + 1), sum) + 1; cnt <= n;
               cnt++) {
            dp[cnt] = 0;
          }
          cnt1++;
        }
      }
    }
  }
  long long ans = 0;
  for (long long cnt = 0; cnt <= n; cnt++) {
    ans = max(ans, dp[cnt]);
  }
  cout << ans;
  return 0;
}
