#include <bits/stdc++.h>
using namespace std;
template <class T>
auto inline rmn(T &a, T b) -> bool {
  return a > b ? (a = b, true) : false;
}
template <class T>
auto inline rmx(T &a, T b) -> bool {
  return a < b ? (a = b, true) : false;
}
const int32_t MOD = 1e9 + 7, INF = 0x3f3f3f3f;
const int64_t INFLL = ((int64_t)INF << 32) | INF;
vector<vector<int64_t>> adj;
vector<int64_t> vis, color;
int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr), cout.tie(nullptr);
  cout << fixed << setprecision(13);
  cerr << fixed << setprecision(3);
  int64_t n, m, k;
  cin >> n >> m >> k;
  adj.resize(n);
  vector<int64_t> last(n);
  iota(begin(last), end(last), 0);
  vector<int64_t> a(n), b(n), c(n);
  for (int64_t i = 0; i < n; ++i) cin >> a[i] >> b[i] >> c[i];
  for (int64_t i = 0; i < m; ++i) {
    int64_t u, v;
    cin >> u >> v;
    --u, --v;
    rmx(last[v], u);
  }
  for (int64_t i = 0; i < n; ++i) {
    adj[last[i]].push_back(i);
  }
  int64_t total = accumulate(b.begin(), b.end(), k);
  vector<int64_t> dp(total + 1, -1);
  dp[k] = 0;
  for (int64_t i = 0; i < n; ++i) {
    fill(begin(dp), begin(dp) + a[i], -1);
    for (int64_t j = total; j >= b[i]; --j) dp[j] = dp[j - b[i]];
    for (int64_t v : adj[i]) {
      for (int64_t j = 1; j <= total; ++j)
        if (dp[j] != -1) rmx(dp[j - 1], dp[j] + c[v]);
    }
  }
  cout << *max_element(dp.begin(), dp.end()) << '\n';
  return 0;
}
