#include <bits/stdc++.h>
using namespace std;
int dy[] = {1, -1, 0, 0, -1, 1, 1, -1};
int dx[] = {0, 0, 1, -1, 1, -1, 1, -1};
void file() {}
void fast() {
  std::ios_base::sync_with_stdio(0);
  cin.tie(NULL);
}
const int N = 5e3 + 9;
int n, m, k;
int mem[N][N], can[N], Try[N];
vector<pair<int, pair<int, int>>> v1;
vector<int> bef[N];
int solve(int idx, int have) {
  if (have < 0) return -1e8;
  if (idx > n) return 0;
  int& ret = mem[idx][have];
  if (ret != -1) return ret;
  ret = -1e8;
  if (have < v1[idx].first) return ret;
  have += v1[idx].second.first;
  ret = solve(idx + 1, have);
  for (int i = 0; i < (int)(bef[idx].size()); i++) {
    ret = max(ret, solve(idx + 1, have - i - 1) + bef[idx][i]);
  }
  return ret;
}
int main() {
  file();
  fast();
  memset(mem, -1, sizeof mem);
  cin >> n >> m >> k;
  v1 = vector<pair<int, pair<int, int>>>(n + 1);
  vector<int> coll(1);
  for (int i = 1; i <= n; i++)
    cin >> v1[i].first >> v1[i].second.first >> v1[i].second.second;
  for (int i = 1; i <= n; i++) can[i] = i;
  for (int i = 0; i < m; i++) {
    int u, v;
    cin >> u >> v;
    can[v] = max(can[v], u);
  }
  for (int i = 1; i <= n; i++) {
    bef[can[i]].push_back(v1[i].second.second);
  }
  for (int i = 1; i <= n; i++) {
    sort(bef[i].rbegin(), bef[i].rend());
    for (int j = 1; j < (int)(bef[i].size()); j++) bef[i][j] += bef[i][j - 1];
  }
  if (solve(1, k) < 0)
    cout << -1 << "\n";
  else
    cout << solve(1, k) << "\n";
  return 0;
}
