#include <bits/stdc++.h>
using namespace std;
const int inf = 0x3f3f3f3f;
const int maxn = 3e5;
struct edge {
  int to, cost;
} f[maxn + 5];
vector<edge> G[maxn + 5];
int d[maxn + 5], cnt[maxn + 5];
void dij(int s) {
  priority_queue<pair<int, int>, vector<pair<int, int> >,
                 greater<pair<int, int> > >
      q;
  d[s] = 0;
  q.push(pair<int, int>(0, s));
  while (!q.empty()) {
    pair<int, int> p = q.top();
    q.pop();
    if (d[p.second] < p.first) continue;
    int len = G[p.second].size();
    for (int i = 0; i < len; i++) {
      edge e = G[p.second][i];
      if (d[e.to] > d[p.second] + e.cost) {
        d[e.to] = d[p.second] + e.cost;
        cnt[e.to] = 1;
        q.push(pair<int, int>(d[e.to], e.to));
      } else if (d[e.to] == d[p.second] + e.cost)
        cnt[e.to]++;
    }
  }
}
int main() {
  int n, m, k;
  scanf("%d %d %d", &n, &m, &k);
  for (int i = 1; i <= m; i++) {
    int u, v, x;
    scanf("%d %d %d", &u, &v, &x);
    G[u].push_back((edge){v, x});
    G[v].push_back((edge){u, x});
  }
  for (int i = 1; i <= k; i++) {
    scanf("%d %d", &f[i].to, &f[i].cost);
    G[1].push_back((edge){f[i].to, f[i].cost});
  }
  for (int i = 1; i <= n; i++) d[i] = inf, cnt[i] = 0;
  dij(1);
  int ans = 0;
  for (int i = 1; i <= k; i++) {
    if (f[i].cost > d[f[i].to])
      ans++;
    else if (f[i].cost == d[f[i].to] && cnt[f[i].to] > 1)
      ans++, cnt[f[i].to]--;
  }
  printf("%d\n", ans);
  return 0;
}
