#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;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