#include <bits/stdc++.h>
using namespace std;
const int MAXN = 100007, INF = 1000000007;
int main() {
  int n, m, k, cnt = 0;
  long long d[MAXN], d1[MAXN];
  vector<pair<int, int> > G[MAXN];
  pair<long long, int> used[MAXN];
  set<pair<long long, int> > S;
  scanf("%d%d%d", &n, &m, &k);
  for (int i = (1); i < (n); ++i) d[i] = d1[i] = 1LL * INF * INF;
  for (int i = (0); i < (m); ++i) {
    int u, v, x;
    scanf("%d%d%d", &u, &v, &x);
    --u;
    --v;
    G[u].push_back(make_pair(v, x));
    G[v].push_back(make_pair(u, x));
  }
  for (int i = (0); i < (k); ++i) {
    int s, ys;
    scanf("%d%d", &s, &ys);
    --s;
    d[s] = min(d[s], 1LL * ys);
  }
  d1[0] = d[0] = 0;
  for (int i = (0); i < (n); ++i) S.insert(make_pair(d[i], i));
  for (int j = (0); j < (n); ++j) {
    int v = S.begin()->second, to;
    for (int i = (0); i < (((int)(G[v]).size())); ++i) {
      to = G[v][i].first;
      if (S.count(make_pair(d[to], to)) && d[v] + G[v][i].second < d[to]) {
        S.erase(make_pair(d[to], to));
        d[to] = d[v] + G[v][i].second;
        S.insert(make_pair(d[to], to));
      }
    }
    S.erase(S.begin());
    used[j] = make_pair(d[v], v);
  }
  sort(used, used + n);
  for (int i = (0); i < (n); ++i) {
    int v = used[i].second, to;
    for (int j = (0); j < (((int)(G[v]).size())); ++j) {
      to = G[v][j].first;
      d1[v] = min(d1[v], d1[to] + G[v][j].second);
    }
    if (d1[v] != d[v]) ++cnt;
    d1[v] = d[v];
  }
  printf("%d", k - cnt);
  return 0;
}
