#include <bits/stdc++.h>
using namespace std;
template <typename T1, typename T2>
inline bool chmin(T1 &a, T2 b) {
  if (a > b) {
    a = b;
    return 1;
  }
  return 0;
}
template <typename T1, typename T2>
inline bool chmax(T1 &a, T2 b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
template <typename T>
T gcd(T a, T b) {
  if (b == 0) return a;
  return gcd(b, a % b);
}
int main() {
  int n, m, k;
  cin >> n >> m >> k;
  vector<int> table(n, -1);
  for (int i = 0; i < (n); ++i) table[i] = i;
  vector<int> a(n), b(n), c(n);
  for (int i = 0; i < (n); ++i) cin >> a[i] >> b[i] >> c[i];
  {
    int have = k;
    for (int i = 0; i < (n); ++i) {
      if (have < a[i]) {
        cout << -1 << endl;
        return 0;
      }
      have += b[i];
    }
  }
  for (int i = 0; i < (m); ++i) {
    int u, v;
    cin >> u >> v;
    u--;
    v--;
    chmax(table[v], u);
  }
  vector<vector<int> > dp(n + 100, vector<int>(5001, -1));
  dp[0][k] = 0;
  for (int i = 0; i < (n); ++i) {
    vector<int> g;
    for (int j = 0; j < (n); ++j) {
      if (table[j] == i) {
        g.emplace_back(c[j]);
      }
    }
    sort(g.begin(), g.end(), greater<int>());
    for (int j = a[i]; j < (5001); ++j) {
      if (dp[i][j] == -1) continue;
      chmax(dp[i + 1][j + b[i]], dp[i][j]);
      int tmp = 0;
      for (int l = 0; l < ((int)g.size()); ++l) {
        tmp += g[l];
        if (j + b[i] - (l + 1) < 0) continue;
        chmax(dp[i + 1][j + b[i] - (l + 1)], dp[i][j] + tmp);
      }
    }
  }
  int ans = 0;
  for (int i = 0; i < (5001); ++i) chmax(ans, dp[n][i]);
  cout << ans << endl;
}
