#include <bits/stdc++.h>
using namespace std;
int N, M, K, ecnt;
long long d[100001];
bool inQ[100001];
struct Train {
  int sa, sb;
} train[100001];
vector<pair<int, int> > path[100001];
bool cmp(Train A, Train B) { return A.sb < B.sb; }
int main() {
  int a, b, c, ans = 0;
  scanf("%d%d%d", &N, &M, &K);
  for (int i = 1; i <= N; i++) d[i] = (long long)1e18;
  while (M--) {
    scanf("%d%d%d", &a, &b, &c);
    path[a].push_back(pair<int, int>(b, c));
    path[b].push_back(pair<int, int>(a, c));
  }
  d[1] = 0;
  std::queue<int> Q;
  Q.push(1);
  while (!Q.empty()) {
    int a = Q.front();
    Q.pop();
    inQ[a] = false;
    for (int i = 0; i < path[a].size(); i++) {
      int b = path[a][i].first, cost = path[a][i].second;
      if (d[a] + cost < d[b]) {
        d[b] = d[a] + cost;
        if (!inQ[b]) {
          inQ[b] = true;
          Q.push(b);
        }
      }
    }
  }
  for (int i = 1; i <= K; i++) scanf("%d%d", &train[i].sa, &train[i].sb);
  std::sort(train + 1, train + K + 1, cmp);
  for (int i = 1; i <= K; i++) {
    if (d[train[i].sa] > train[i].sb) {
      d[train[i].sa] = train[i].sb;
      ans++;
      std::queue<int> Q;
      Q.push(train[i].sa);
      while (!Q.empty()) {
        int a = Q.front();
        Q.pop();
        inQ[a] = false;
        for (int i = 0; i < path[a].size(); i++) {
          int b = path[a][i].first, cost = path[a][i].second;
          if (d[a] + cost < d[b]) {
            d[b] = d[a] + cost;
            if (!inQ[b]) {
              inQ[b] = true;
              Q.push(b);
            }
          }
        }
      }
    }
  }
  printf("%d\n", K - ans);
  return 0;
}
