#include <bits/stdc++.h>
using namespace std;
inline bool EQ(double a, double b) { return fabs(a - b) < 1e-9; }
long long int INF = -99999999999999;
inline int two(int n) { return 1 << n; }
inline int test(int n, int b) { return (n >> b) & 1; }
inline void set_bit(int& n, int b) { n |= two(b); }
inline void unset_bit(int& n, int b) { n &= ~two(b); }
inline int last_bit(int n) { return n & (-n); }
inline int ones(int n) {
  int res = 0;
  while (n && ++res) n -= n & (-n);
  return res;
}
priority_queue<int> mp[5005];
long long int dp[5005][5005], a[5005], b[5005], c[5005], n, m, k;
long long int dpf(int castle, int soldiers) {
  if (dp[castle][soldiers] != -1) return dp[castle][soldiers];
  if (castle == n) return 0;
  if (soldiers < a[castle]) return INF;
  int nexsol = soldiers + b[castle];
  dp[castle][soldiers] = dpf(castle + 1, nexsol);
  long long int sum = 0;
  priority_queue<int> l = mp[castle];
  while (!l.empty()) {
    nexsol--;
    sum += (long long int)l.top();
    dp[castle][soldiers] =
        max(dp[castle][soldiers], sum + dpf(castle + 1, nexsol));
    l.pop();
  }
  return dp[castle][soldiers];
}
int main() {
  memset(dp, -1, sizeof(dp));
  cin >> n >> m >> k;
  int farthest_possible[5005];
  for (int i = 0; i < n; i++) {
    cin >> a[i] >> b[i] >> c[i];
    farthest_possible[i] = i;
  }
  for (int i = 0; i < m; i++) {
    int u, v;
    cin >> u >> v;
    farthest_possible[v - 1] = max(farthest_possible[v - 1], u - 1);
  }
  for (int i = 0; i < n; i++) {
    mp[farthest_possible[i]].push(c[i]);
  }
  long long int ga = dpf(0, k);
  if (ga < 0)
    cout << -1;
  else
    cout << ga;
}
