#include <bits/stdc++.h>
using namespace std;
vector<vector<pair<int, int> > > adj;
void djk(vector<long long>& D, vector<bool>& f) {
  set<pair<long long, int> > Q;
  D[0] = 0;
  Q.insert(make_pair(D[0], 0));
  for (int i = 0; i < int(int((adj).size())); i++) {
    if (f[i]) {
      Q.insert(make_pair(D[i], i));
    }
  }
  while (!Q.empty()) {
    int u = Q.begin()->second;
    Q.erase(Q.begin());
    for (auto first : (adj[u])) {
      int v, w;
      tie(v, w) = first;
      if (D[v] >= D[u] + w) {
        Q.erase(make_pair(D[v], v));
        D[v] = D[u] + w;
        f[v] = false;
        Q.insert(make_pair(D[v], v));
      }
    }
  }
}
int main() {
  std::ios_base::sync_with_stdio(false);
  int n, m, k;
  cin >> n >> m >> k;
  adj.resize(n);
  vector<long long> D(n, LLONG_MAX / 3);
  vector<bool> f(n);
  for (int i = 0; i < int(m); i++) {
    int u, v, first;
    cin >> u >> v >> first;
    adj[u - 1].push_back(make_pair(v - 1, first));
    adj[v - 1].push_back(make_pair(u - 1, first));
  }
  for (int i = 0; i < int(k); i++) {
    int s, first;
    cin >> s >> first;
    D[s - 1] = min(D[s - 1], 1ll * first);
    f[s - 1] = true;
  }
  djk(D, f);
  cout << k - accumulate((f).begin(), (f).end(), 0);
  return 0;
}
