#include <bits/stdc++.h>
using namespace std;
struct edge {
  int to, w;
  bool del;
};
edge make(int to, int w, bool del) {
  edge e;
  e.to = to, e.w = w, e.del = del;
  return e;
}
int main() {
  int n, m, k, x, y, z;
  scanf("%d %d %d", &n, &m, &k);
  vector<edge> a[n];
  for (int i = 0; i < m; i++) {
    scanf("%d %d %d", &x, &y, &z), x--, y--;
    a[x].emplace_back(make(y, z, false));
    a[y].emplace_back(make(x, z, false));
  }
  for (int i = 0; i < k; i++) {
    scanf("%d %d", &y, &z), y--;
    a[0].emplace_back(make(y, z, true));
    a[y].emplace_back(make(0, z, true));
  }
  int d[n];
  fill(d, d + n, 2147483647), d[0] = 0;
  priority_queue<pair<int, int>, vector<pair<int, int> >,
                 greater<pair<int, int> > >
      pq;
  pq.emplace(0, 0);
  while (!pq.empty()) {
    int cd = pq.top().first, c = pq.top().second;
    pq.pop();
    if (cd > d[c]) continue;
    for (edge e : a[c]) {
      if (d[e.to] > cd + e.w) {
        d[e.to] = cd + e.w;
        pq.emplace(d[e.to], e.to);
      }
    }
  }
  int deg[n], ans = k;
  fill(deg, deg + n, 0);
  for (int i = 0; i < n; i++) {
    for (edge e : a[i]) {
      if (d[e.to] == d[i] + e.w) {
        deg[e.to]++;
        if (e.del) ans--;
      }
    }
  }
  for (edge e : a[0]) {
    if (d[e.to] == e.w) {
      if (e.del && deg[e.to] > 1) ans++, deg[e.to]--;
    }
  }
  printf("%d\n", ans);
}
