#include <bits/stdc++.h>
using namespace std;
struct UnionFind {
  vector<int> par, sz;
  int n_tree;
  explicit UnionFind(int n) : par(n), sz(n, 1), n_tree(n) {
    iota(par.begin(), par.end(), 0);
  }
  int n_cluster() const { return n_tree; }
  int size(int x) { return sz[root(x)]; }
  int root(int x) { return x == par[x] ? x : par[x] = root(par[x]); }
  bool unite(int x, int y) {
    int rx = root(x), ry = root(y);
    if (rx != ry) {
      par[rx] = ry;
      --n_tree;
      sz[ry] += sz[rx];
      return true;
    }
    return false;
  }
  bool same(int x, int y) { return root(x) == root(y); }
  bool is_root(int x) const { return par[x] == x; }
};
int gcd(int x, int y) { return y == 0 ? x : gcd(y, x % y); }
const int N = 5005;
int dp[N][N];
int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  int n;
  int m, k;
  cin >> n >> m >> k;
  vector<int> a(n), b(n), c(n);
  for (int i = 0; i < n; i++) {
    cin >> a[i] >> b[i] >> c[i];
  }
  vector<int> at_least(n + 1);
  at_least[n - 1] = a[n - 1];
  for (int i = n - 2; i >= 0; i--) {
    at_least[i] = max(a[i], at_least[i + 1] - b[i]);
  }
  if (k < at_least[0]) {
    cout << "-1\n";
    return 0;
  }
  if (k >= at_least[0] + n) {
    cout << accumulate(c.begin(), c.end(), 0) << '\n';
    return 0;
  }
  vector<int> from(n);
  iota(from.begin(), from.end(), 0);
  for (int i = 0; i < m; ++i) {
    int u, v;
    cin >> u >> v;
    --u, --v;
    from[v] = max(from[v], u);
  }
  vector<vector<int>> to(n);
  for (int i = 0; i < n; ++i) {
    to[from[i]].push_back(i);
  }
  auto cmp = [&](int x, int y) { return c[x] > c[y]; };
  for (int i = 0; i < n; ++i) {
    sort(to[i].begin(), to[i].end(), cmp);
  }
  vector<vector<int>> gain(n);
  for (int i = 0; i < n; ++i) {
    gain[i].push_back(0);
    for (auto j : to[i]) {
      gain[i].push_back(gain[i].back() + c[j]);
    }
  }
  memset(dp, -1, sizeof dp);
  dp[0][k] = 0;
  int at_most = k;
  for (int i = 0; i < n; ++i) {
    for (int j = at_least[i]; j <= at_most; ++j) {
      if (dp[i][j] != -1) {
        for (int k = 0;
             k < (int)gain[i].size() && j + b[i] - k >= at_least[i + 1]; ++k) {
          dp[i + 1][j + b[i] - k] =
              max(dp[i + 1][j + b[i] - k], dp[i][j] + gain[i][k]);
        }
      }
    }
    at_most += b[i];
  }
  int ans = -1;
  for (int i = 0; i <= at_most; i++) {
    ans = max(ans, dp[n][i]);
  }
  cout << ans << endl;
  return 0;
}
