//****** @mdazmat9 **********
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define UB upper_bound
#define LB lower_bound
#define BS binary_search
#define EB emplace_back
#define PB push_back
#define endl "\n"
#define MOD 1000000007
#define MOD2 998244353
#define F first
#define S second
#define ALL(a) (a).begin(),(a).end()
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0)
int fast_pow(int x, int y, int p);
map<int,vector<pair<int,int>>> save;
class Node{
public:
    int a,b,profit;
};
Node node[5001];
int dp[5001][5001];
int n;
int rec(int pos,int k){
    if(pos==n){
        return 0;
    }
    if(dp[pos][k]!=-1){
        return dp[pos][k];
    }
    int ans=INT_MIN;
    if(k>=node[pos].a){
        k+=node[pos].b;
        ans=max(ans,rec(pos+1,k));
        int cnt=1;
        int temp=0;
        for(auto x:save[pos]){
            if(k-cnt>=0){
                temp+=x.F;
                ans=max(ans,temp+rec(pos+1,k-cnt));
                cnt++;
            }
        }
    }
    return dp[pos][k]=ans;
}

void solve() {
    int m,k;cin>>n>>m>>k;
    for(int i=0;i<n;i++){
        cin>>node[i].a>>node[i].b>>node[i].profit;
    }
    map<int,int> mp;
    for(int i=0;i<m;i++){
        int u,v;cin>>u>>v;
        u--;v--;
        mp[v]=max(mp[v],u);
    }
    for(int i=0;i<n;i++){
        mp[i]=max(i,mp[i]);
    }
    for(auto x:mp){
        save[x.S].EB(node[x.F].profit,x.F);
    }

    for(auto& x:save){
        sort(ALL(x.S),greater<pair<int,int>>());
    }
    memset(dp,-1, sizeof(dp));
    cout<<max(-1ll,rec(0,k))<<endl;

}
int32_t main() {
    IOS;
    int test = 1;
//    cin >> test;
    for(int i=1;i<=test;i++){
        solve();
    }
    return 0;
}
int fast_pow(int x, int y, int p) {
    int res = 1;
    x = x % p;
    while (y > 0) {
        if (y & 1)
            res = (res * x) % p;
        y = y >> 1;
        x = (x * x) % p;
    }
    return res;
}