#include <bits/stdc++.h>
using namespace std;
const int N = 5002;
const int M = 3e5 + 45;
const int W = 5002;
int n, m, k;
int a[N], b[N], c[N];
int najv[M];
vector<int> defend[N];
int dp[N][W];
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cin >> n >> m >> k;
  for (int i = 1; i <= n; i++) {
    cin >> a[i] >> b[i] >> c[i];
  }
  for (int i = 1; i <= n; i++) {
    najv[i] = i;
  }
  for (int i = 1; i <= m; i++) {
    int u, v;
    cin >> u >> v;
    najv[v] = max(najv[v], u);
  }
  for (int i = 1; i <= n; i++) {
    defend[najv[i]].push_back(c[i]);
  }
  for (int i = 1; i <= n; i++) {
    sort(defend[i].begin(), defend[i].end());
    reverse(defend[i].begin(), defend[i].end());
    for (int j = 1; j < defend[i].size(); j++) {
      defend[i][j] += defend[i][j - 1];
    }
  }
  for (int i = 0; i <= n; i++) {
    for (int j = 0; j <= 5000; j++) {
      dp[i][j] = -1;
    }
  }
  dp[0][k] = 0;
  for (int i = 1; i <= n; i++) {
    for (int j = 5000; j >= 0; j--) {
      if (j >= b[i] && j - b[i] >= a[i] && dp[i - 1][j - b[i]] != -1) {
        dp[i][j] = max(dp[i][j], dp[i - 1][j - b[i]]);
      }
      for (int h = 0; h < defend[i].size(); h++) {
        if (j - b[i] + h + 1 >= 0 && j - b[i] + h + 1 <= 5000 &&
            j - b[i] + h + 1 >= a[i] && dp[i - 1][j - b[i] + h + 1] != -1) {
          dp[i][j] = max(dp[i][j], dp[i - 1][j - b[i] + h + 1] + defend[i][h]);
        }
      }
    }
  }
  int sol = -1;
  for (int j = 5000; j >= 0; j--) {
    sol = max(sol, dp[n][j]);
  }
  cout << sol << endl;
}
