#include<iostream>
#include<cstdio>
#include<algorithm>
#include<vector>
#include<set>
#include<utility>
#include<cstring>
#include<stack>
#include<queue>
#include<map>
#include<deque>
#include<cmath>
#include<map>
using namespace std;
typedef long long LL;
typedef pair<LL, LL> pii;
typedef pair<LL, pii> edge;

#define inf 1000000000000000LL
const int maxn = 100003;
LL n, m, k;
vector<pii> vr[maxn];
vector<LL> v[maxn];
LL dist[maxn][2];
bool used[maxn];

void dij(int t) {
	for (int i = 0; i < maxn; i++) {
		dist[i][t] = inf;
	}
	dist[0][t] = 0;
	priority_queue<pii, vector<pii>, greater<pii> > pq;
	pq.push(pii(0, 0));
	while (pq.size()) {
		LL cur = pq.top().second;
		LL dst = pq.top().first;
		pq.pop();
		if (dst != dist[cur][t]) continue;
		for (int i = 0; i < vr[cur].size(); i++) {
			LL nxt = vr[cur][i].first;
			LL c = vr[cur][i].second;
			if (dist[cur][t] + c < dist[nxt][t]) {
				dist[nxt][t] = dist[cur][t] + c;
				pq.push(pii(dist[nxt][t], nxt));
			}
		}
	}
}
int main() {
	scanf("%I64d%I64d%I64d", &n, &m, &k);
	for (int i = 0; i < m; i++) {
		LL a, b, d;
		scanf("%I64d%I64d%I64d", &a, &b, &d);
		a--; b--;
		vr[a].push_back(pii(b, d));
		vr[b].push_back(pii(a, d));
	}
	dij(0);
	for (int i = 0; i < k; i++) {
		LL a, d;
		scanf("%I64d%I64d", &a, &d);
		a--;
		vr[0].push_back(pii(a, d));
		vr[a].push_back(pii(0, d));
		v[a].push_back(d);
	}
	dij(1);
	for (int i = 0; i < n; i++) {
		if (dist[i][1] < dist[i][0]) {
			used[i] = true;
		}
		else if (dist[i][1] >= dist[i][0]) {
			used[i] = false;
		}
	}

	int ct = 0;
	for (int i = 1; i < n; i++) {
		LL d = min(dist[i][1], dist[i][0]);
		if (used[i]) {
			for (int j = 0; j < v[i].size(); j++) if (v[i][j] == d) ct++;
			ct--;
			for (int j = 0; j < v[i].size(); j++) {
				if (v[i][j] > d) ct++;
			}
		//	cout << ct;
		}
		else {
			for (int j = 0; j < v[i].size(); j++) if (v[i][j] >= d) ct++;
		//	cout << ct;
		}
		//cout << i << ' ' << ct << endl;
	}
	cout << ct;
}
