#include <bits/stdc++.h>
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
//using namespace __gnu_pbds;
// #pragma GCC optimize("O3,unroll-loops")
// #pragma GCC target("avx2")
#define watch(x) cout<<(#x)<<"="<<(x)<<'\n'
#define mset(d,val) memset(d,val,sizeof(d))
#define cbug if(DEBUG) cout
#define setp(x) cout<<fixed<<setprecision(x)
#define sz(x) (int)(x).size()
#define all(x) begin(x), end(x)
#define forn(i,a,b) for(int i=(a);i<(b);i++)
#define fore(i,a,b) for(int i=(a);i<=(b);i++)
#define pb push_back
#define F first
#define S second
#define fbo find_by_order
#define ook order_of_key
typedef long long ll;
typedef long double ld;
typedef pair<ll,ll> ii;
typedef vector<ll> vi;
typedef vector<ii> vii;
//template<typename T>
//using pbds = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
void SD(int t=0){ cout<<"PASSED "<<t<<endl; }
ostream& operator<<(ostream &out, ii x){ out<<"("<<x.F<<","<<x.S<<")"; return out; }
template<typename T> void amax(T &a, T b){ a=max(a,b); }
template<typename T> void amin(T &a, T b){ a=min(a,b); }
struct Hash {
static uint64_t splitmix64(uint64_t x) {
// http://xorshift.di.unimi.it/splitmix64.c
x += 0x9e3779b97f4a7c15;
x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9;
x = (x ^ (x >> 27)) * 0x94d049bb133111eb;
return x ^ (x >> 31);
}
size_t operator()(uint64_t x) const {
static const uint64_t FIXED_RANDOM = chrono::steady_clock::now().time_since_epoch().count();
return splitmix64(x + FIXED_RANDOM);
}
};
const ll INF = ll(1e18);
const int MOD = 998244353;
const bool DEBUG = 0;
const int MAXN = 100005;
const int LG = 21;
struct Card
{
ll d,k,c;
};
int n,m;
ll R;
vector<Card> cards;
vector<ll> day;
vector<ll> dp;
int main()
{
cin.tie(0)->sync_with_stdio(0);
cin>>n>>m>>R;
cards.resize(n);
day.reserve(m);
forn(i,0,n)
{
ll d,k,c; cin>>d>>k>>c;
cards[i] = {d, k, c};
}
forn(i,0,m)
{
ll t,q; cin>>t>>q;
forn(j,0,q) day.pb(t);
}
sort(all(day));
m = sz(day);
dp.resize(m);
forn(i,0,m)
{
dp[i] = R;
if (i) dp[i] += dp[i - 1];
for (const auto& [d, k, c] : cards)
{
ll prepos = i - k;
auto it = upper_bound(all(day), day[i] - d);
if (it != day.begin())
{
it--;
amax(prepos, it - day.begin());
}
ll pre = 0;
if (prepos >= 0) pre = dp[prepos];
amin(dp[i], pre + c);
}
}
cout << dp[m - 1] << '\n';
return 0;
}