#include <bits/stdc++.h>
using namespace std;
const int MAX_N = 100000;
const int MAX_M = 300000;
const int MAX_K = 100000;
const long long LINF = 1LL << 62;
struct Edge {
  int i, j, w;
  Edge() {}
  Edge(int _i, int _j, int _w) : i(_i), j(_j), w(_w) {}
};
Edge res[MAX_M], tes[MAX_K];
vector<pair<int, int> > nbrs[MAX_N];
long long ds[MAX_N];
int ies[MAX_N];
int main() {
  int n, m, k;
  scanf("%d%d%d", &n, &m, &k);
  for (int i = 0; i < m; i++) {
    int u, v, x;
    scanf("%d%d%d", &u, &v, &x);
    u--, v--;
    res[i] = Edge(u, v, x);
    nbrs[u].push_back(pair<int, int>(v, x));
    nbrs[v].push_back(pair<int, int>(u, x));
  }
  for (int i = 0; i < k; i++) {
    int s, y;
    scanf("%d%d", &s, &y);
    s--;
    tes[i] = Edge(0, s, y);
    nbrs[0].push_back(pair<int, int>(s, y));
  }
  fill(ds, ds + n, LINF);
  ds[0] = 0;
  priority_queue<pair<long long, int> > q;
  q.push(pair<long long, int>(0, 0));
  while (!q.empty()) {
    pair<long long, int> u = q.top();
    q.pop();
    long long ud = -u.first;
    int ui = u.second;
    if (ud != ds[ui]) continue;
    vector<pair<int, int> > &nbru = nbrs[ui];
    for (vector<pair<int, int> >::iterator vit = nbru.begin();
         vit != nbru.end(); vit++) {
      int vi = vit->first;
      long long vd = ud + vit->second;
      if (ds[vi] > vd) {
        ds[vi] = vd;
        q.push(pair<long long, int>(-vd, vi));
      }
    }
  }
  for (int i = 0; i < m; i++) {
    Edge &e = res[i];
    if (ds[e.i] + e.w == ds[e.j])
      ies[e.j]++;
    else if (ds[e.j] + e.w == ds[e.i])
      ies[e.i]++;
  }
  int c = 0;
  for (int i = 0; i < k; i++) {
    Edge &e = tes[i];
    if (ds[e.i] + e.w == ds[e.j] && ies[e.j] == 0)
      ies[e.j]++;
    else
      c++;
  }
  printf("%d\n", c);
  return 0;
}
