#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
#define pb push_back
#define endl '\n'
#define INF (long long)1e15
#define EPS 1e-9
ll n, m, k;
vector<pair<pair<ll,ll>, ll> >adj[100010];
ll dist[300010], from[300010];
void dijkstra(){
for(ll i = 1; i <= n; i++){
dist[i] = INF;
from[i] = 0;
}
priority_queue< pair<ll,ll>, vector<pair<ll,ll> >, greater<pair<ll,ll> > >pq;
dist[1] = 0;
pq.push(make_pair(0, 1) );
while(!pq.empty()){
ll cur = pq.top().second;
pq.pop();
for(int i = 0; i < adj[cur].size(); i++){
ll next = adj[cur][i].second;
ll w = adj[cur][i].first.first;
if( (dist[next] > dist[cur]+w) ){
dist[next] = dist[cur]+w;
from[next] = adj[cur][i].first.second;
pq.push( make_pair(dist[next], next) );
}
else if(dist[next] == dist[cur]+w){
if(adj[cur][i].first.second == 0){
from[next] = 0;
}
}
}
}
}
int main(){
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cin >> n >> m >> k;
ll a, b, w;
for(ll i = 0; i < m; i++){
cin >> a >> b >> w;
adj[a].push_back(make_pair(make_pair(w, 0), b));
adj[b].push_back(make_pair(make_pair(w, 0), a));
}
for(ll i = 0; i < k; i++){
cin >> a >> w;
adj[1].push_back(make_pair(make_pair(w, 1), a));
}
dijkstra();
ll ans = k;
for(ll i = 1; i <= n; i++){
ans -= from[i];
}
cout << ans;
}
I2luY2x1ZGU8Yml0cy9zdGRjKysuaD4KdXNpbmcgbmFtZXNwYWNlIHN0ZDsKCnR5cGVkZWYgbG9uZyBsb25nIGxsOwp0eXBlZGVmIHZlY3RvcjxpbnQ+IHZpOwp0eXBlZGVmIHZlY3RvcjxsbD4gdmw7CgojZGVmaW5lIHBiIHB1c2hfYmFjawojZGVmaW5lIGVuZGwgJ1xuJwojZGVmaW5lIElORiAobG9uZyBsb25nKTFlMTUKI2RlZmluZSBFUFMgMWUtOQoKbGwgbiwgbSwgazsKdmVjdG9yPHBha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