#include <bits/stdc++.h>
using namespace std;
int dp[5010][5010], req[5010], arm[5010], c[5010], maxi[5010], n;
vector<int> bt[5010];
int fun(int a, int b) {
  if (b < 0) return -1e9;
  if (b < req[a]) return -1e9;
  if (a == n) {
    return 0;
  }
  if (dp[a][b] != -1) return dp[a][b];
  int maxi = fun(a + 1, b + arm[a]), cur = 0;
  for (int i = 0; i < bt[a].size(); i++) {
    maxi = max(maxi, cur + bt[a][i] + fun(a + 1, b - (i + 1) + arm[a]));
    cur += bt[a][i];
  }
  return dp[a][b] = maxi;
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(NULL);
  int m, k;
  cin >> n >> m >> k;
  for (int i = 0; i < n; i++) {
    cin >> req[i] >> arm[i] >> c[i];
  }
  memset(maxi, -1, sizeof(maxi));
  memset(dp, -1, sizeof(dp));
  for (int i = 0; i < n; i++) maxi[i] = i;
  for (int i = 0; i < m; i++) {
    int a, b;
    cin >> a >> b;
    a--;
    b--;
    maxi[b] = max(maxi[b], a);
  }
  for (int i = 0; i < n; i++) {
    bt[maxi[i]].push_back(c[i]);
  }
  for (int i = 0; i < n; i++) {
    sort(bt[i].begin(), bt[i].end());
    reverse(bt[i].begin(), bt[i].end());
  }
  int ans = fun(0, k);
  if (ans < 0)
    cout << -1 << '\n';
  else
    cout << ans << '\n';
}
