#include <bits/stdc++.h>
using namespace std;
const int maxZ = 5001;
vector<int> nei[5000];
int dp[5002][10001];
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int n, m, stz;
  cin >> n >> m >> stz;
  vector<int> a(n), b(n), c(n);
  for (int i = 0; i < n; ++i) cin >> a[i] >> b[i] >> c[i];
  vector<int> r(n);
  for (int i = 0; i < n; ++i) r[i] = i;
  while (m--) {
    int u, v;
    cin >> u >> v;
    --u;
    --v;
    r[v] = max(r[v], u);
  }
  for (int i = 0; i < n; ++i) {
    nei[r[i]].push_back(i);
  }
  for (int i = 0; i < n; ++i)
    for (int z = 0; z <= maxZ; ++z) dp[i][z] = -1;
  if (stz >= a[0])
    for (int z = 0; z <= stz + b[0]; ++z) {
      dp[0][z] = max(dp[0][z], 0);
      if (z <= stz && z - 1 >= 0 && r[0] == 0)
        dp[0][z - 1] = max(dp[0][z - 1], c[0]);
    }
  for (int i = 1; i < n; ++i) {
    sort(nei[i].begin(), nei[i].end(),
         [&c](int x, int y) { return c[x] > c[y]; });
    for (int z = 0; z <= maxZ; ++z) {
      int s = 0;
      for (int k = 0; k <= nei[i].size(); ++k) {
        if (k) {
          s += c[nei[i][k - 1]];
        }
        int prev = z - b[i] + k;
        if (prev < a[i] || prev > maxZ || dp[i - 1][prev] == -1) continue;
        dp[i][z] = max(dp[i][z], s + dp[i - 1][prev]);
      }
    }
    for (int z = maxZ - 1; z >= 0; --z) {
      dp[i][z] = max(dp[i][z], dp[i][z + 1]);
    }
  }
  int ans = -1;
  for (int z = 0; z <= maxZ; ++z) {
    ans = max(ans, dp[n - 1][z]);
  }
  cout << ans << '\n';
}
