#include <bits/stdc++.h>
using namespace std;
template <class T>
bool chmax(T& a, const T& b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
template <class T>
bool chmin(T& a, const T& b) {
  if (b < a) {
    a = b;
    return 1;
  }
  return 0;
}
const long long int MOD = 1e9 + 7, INF = 1e18;
long long int dx[8] = {0, -1, 1, 0, 1, -1, 1, -1},
              dy[8] = {1, 0, 0, -1, -1, -1, 1, 1};
struct edge {
  long long int cost;
  long long int u, v;
};
long long int N, M, K, A[5000], B[5000], C[5000], u, v;
long long int dp[5001][5001];
long long int maxv[5001];
vector<long long int> to[5000];
vector<long long int> sums[5000];
int main() {
  cin >> N >> M >> K;
  for (long long int i = (0), i_end_ = (N); i < i_end_; i++) {
    cin >> A[i] >> B[i] >> C[i];
    maxv[i] = i;
  }
  for (long long int i = (0), i_end_ = (M); i < i_end_; i++) {
    cin >> u >> v;
    u--;
    v--;
    chmax(maxv[v], u);
  }
  for (long long int i = (0), i_end_ = (N); i < i_end_; i++) {
    to[maxv[i]].push_back(C[i]);
  }
  for (long long int i = (0), i_end_ = (N); i < i_end_; i++) {
    sort((to[i]).begin(), (to[i]).end(), greater<long long int>());
    sums[i].push_back(0);
    for (long long int j = (0), j_end_ = (((long long int)(to[i]).size()));
         j < j_end_; j++) {
      sums[i].push_back(sums[i].back() + to[i][j]);
    }
  }
  for (long long int i = (0), i_end_ = (N + 1); i < i_end_; i++) {
    for (long long int j = (0), j_end_ = (5001); j < j_end_; j++) {
      dp[i][j] = -1;
    }
  }
  dp[0][K] = 0;
  for (long long int i = (0), i_end_ = (N); i < i_end_; i++) {
    for (long long int j = (0), j_end_ = (5001); j < j_end_; j++) {
      if (dp[i][j] == -1) continue;
      if (j >= A[i]) chmax(dp[i + 1][j + B[i]], dp[i][j]);
    }
    for (long long int j = (0), j_end_ = (5001); j < j_end_; j++) {
      if (dp[i + 1][j] == -1) continue;
      for (long long int k = (0), k_end_ = (((long long int)(sums[i]).size()));
           k < k_end_; k++) {
        if (j - k >= 0) chmax(dp[i + 1][j - k], dp[i + 1][j] + sums[i][k]);
      }
    }
  }
  long long int ans = -1;
  for (long long int i = (0), i_end_ = (5001); i < i_end_; i++) {
    chmax(ans, dp[N][i]);
  }
  cout << ans << '\n';
}
