#include <bits/stdc++.h>
using namespace std;
const int INF = 1e9;
const int N = 5e3 + 5;
int n, m, k;
vector<int> a, b, c, mx;
vector<vector<int>> adj;
int memo[N][N];
int solve(int idx, int rem) {
  if (idx > n) {
    return (rem >= 0 ? 0 : -INF);
  }
  if (rem < a[idx]) {
    return -INF;
  }
  int &ret = memo[idx][rem];
  if (~ret) {
    return ret;
  }
  ret = solve(idx + 1, rem + b[idx]);
  int tot = 0;
  for (int i = 0; i < adj[idx].size(); i++) {
    tot += adj[idx][i];
    ret = max(ret, solve(idx + 1, rem + b[idx] - i - 1) + tot);
  }
  return ret;
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin >> n >> m >> k;
  a.resize(n + 1), b.resize(n + 1), c.resize(n + 1);
  for (int i = 1; i <= n; i++) {
    cin >> a[i] >> b[i] >> c[i];
  }
  mx.assign(n + 1, -1);
  while (m--) {
    int u, v;
    cin >> u >> v;
    mx[v] = max(mx[v], u);
  }
  adj.resize(n + 1);
  for (int i = 1; i <= n; i++) {
    if (mx[i] >= 0) {
      adj[mx[i]].push_back(c[i]);
    } else {
      adj[i].push_back(c[i]);
    }
  }
  for (int i = 1; i <= n; i++) {
    sort(adj[i].rbegin(), adj[i].rend());
  }
  memset(memo, -1, sizeof memo);
  int ans = solve(1, k);
  cout << (ans >= 0 ? ans : -1) << '\n';
}
