#include <bits/stdc++.h>
using namespace std;
long long Inf = 1000000000000000000;
int main() {
  int i, j, k, n, m, u, v, s, ele, child, cnt = 0;
  scanf("%d %d %d", &n, &m, &k);
  long long dis[n], child_dis, y, len;
  vector<pair<int, long long> > graph[n];
  set<pair<long long, int> > dijkstra;
  set<pair<long long, int> >::iterator it;
  pair<long long, int> ii;
  bool train_route[n], done[n];
  for (i = 0; i < m; i++) {
    scanf("%d %d", &u, &v);
    cin >> len;
    u--;
    v--;
    graph[u].push_back(make_pair(v, len));
    graph[v].push_back(make_pair(u, len));
  }
  for (i = 0; i < n; i++) {
    dis[i] = Inf;
    train_route[i] = false;
    done[i] = true;
  }
  for (i = 0; i < k; i++) {
    scanf("%d", &s);
    cin >> y;
    if (dis[s - 1] != Inf) {
      cnt++;
    }
    dis[s - 1] = min(dis[s - 1], y);
    train_route[s - 1] = true;
    done[s - 1] = false;
  }
  dis[0] = 0;
  dijkstra.insert(make_pair(0, 0));
  while (dijkstra.size()) {
    if (dijkstra.size() > 5000000) {
      cout << "Wrong";
    }
    it = dijkstra.begin();
    ii = *it;
    dijkstra.erase(ii);
    ele = ii.second;
    if (ii.first != dis[ele]) {
      continue;
    }
    for (i = 0; i < graph[ele].size(); i++) {
      child = graph[ele][i].first;
      child_dis = graph[ele][i].second;
      if (child_dis + dis[ele] <= dis[child]) {
        dis[child] = child_dis + dis[ele];
        dijkstra.insert(make_pair(dis[child], child));
        if (train_route[child]) {
          cnt++;
          train_route[child] = false;
          done[true];
        }
      }
      if (!done[child]) {
        dijkstra.insert(make_pair(dis[child], child));
        done[child] = true;
      }
    }
  }
  printf("%d", cnt);
}
