#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1e9 + 7;
const long long N = 5e3 + 10;
long long a[N], b[N], c[N];
long long dp[N][N];
vector<long long> ans[N];
long long last[N];
long long n;
long long go(long long pos, long long army) {
  if (a[pos] > army) return -1e9;
  if (pos > n) return 0;
  long long &ans1 = dp[pos][army];
  if (ans1 != -1) return ans1;
  ans1 = go(pos + 1, army + b[pos]);
  long long sum = 0;
  for (long long i = 0; i < ans[pos].size(); i++) {
    sum += ans[pos][i];
    if (army + b[pos] >= i + 1)
      ans1 = max(ans1, sum + go(pos + 1, army + b[pos] - (i + 1)));
  }
  return ans1;
}
int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  long long m, k;
  cin >> n >> m >> k;
  for (long long i = 1; i <= n; i++) {
    last[i] = i;
    cin >> a[i] >> b[i] >> c[i];
  }
  long long x, y;
  for (long long i = 1; i <= m; i++) {
    cin >> x >> y;
    last[y] = max(last[y], x);
  }
  for (long long i = 1; i <= n; i++) {
    ans[last[i]].push_back(c[i]);
  }
  for (long long i = 1; i <= n; i++) {
    sort(ans[i].begin(), ans[i].end());
    reverse(ans[i].begin(), ans[i].end());
  }
  memset(dp, -1, sizeof(dp));
  long long ans1 = go(1, k);
  if (ans1 < 0) ans1 = -1;
  cout << ans1 << endl;
}
