#include <bits/stdc++.h>
using namespace std;
int n, m, K;
vector<int> gnext[100003];
vector<int> gcost[100003];
vector<int> gtrain[100003];
int train[100003];
int v[100003];
int from[100003];
long long dist[100003];
int main() {
  scanf("%d%d%d", &n, &m, &K);
  for (int i = 0; i < m; i++) {
    int a, b, c;
    scanf("%d%d%d", &a, &b, &c);
    a--, b--;
    gnext[a].push_back(b);
    gcost[a].push_back(c);
    gtrain[a].push_back(-1);
    gnext[b].push_back(a);
    gcost[b].push_back(c);
    gtrain[b].push_back(-1);
  }
  for (int i = 0; i < K; i++) {
    int trainCity, trainDist;
    scanf("%d%d", &trainCity, &trainDist);
    trainCity--;
    gnext[0].push_back(trainCity);
    gcost[0].push_back(trainDist);
    gtrain[0].push_back(i);
    gnext[trainCity].push_back(0);
    gcost[trainCity].push_back(trainDist);
    gtrain[trainCity].push_back(i);
  }
  for (int i = 0; i < n; i++) {
    dist[i] = LLONG_MAX;
    from[i] = -1;
  }
  dist[0] = 0;
  priority_queue<pair<long long, int>> pq;
  pq.push(make_pair(0, 0));
  while (!pq.empty()) {
    int vmin = pq.top().second;
    pq.pop();
    if (v[vmin]) continue;
    v[vmin] = 1;
    for (int j = 0; j < gnext[vmin].size(); j++) {
      int next = gnext[vmin][j];
      long long cost = gcost[vmin][j] + dist[vmin];
      if (v[next]) continue;
      if (dist[next] > cost) {
        dist[next] = cost;
        from[next] = gtrain[vmin][j];
        pq.push(make_pair(-cost, next));
      } else if (dist[next] == cost) {
        if (gtrain[vmin][j] < 0) {
          from[next] = -1;
        }
      }
    }
  }
  int ans = 0;
  for (int i = 0; i < n; i++) {
    if (from[i] >= 0) {
      train[from[i]]++;
    }
  }
  for (int i = 0; i < K; i++) {
    if (!train[i]) {
      ans++;
    }
  }
  printf("%d\n", ans);
  return 0;
}
