#include <bits/stdc++.h>
using namespace std;
const int INF = 0x3f3f3f3f;
int N, M, K;
vector<pair<int, int> > V[100002];
int D[100002];
bool mod[100002];
priority_queue<pair<int, int> > Q;
int main() {
  cin.sync_with_stdio(false);
  cin >> N >> M >> K;
  for (int i = 1, nod1, nod2, cost; i <= M; ++i) {
    cin >> nod1 >> nod2 >> cost;
    V[nod1].push_back(make_pair(nod2, cost));
    V[nod2].push_back(make_pair(nod1, cost));
  }
  memset(D, 0x3f, sizeof(D));
  D[1] = 0;
  for (int i = 1, nod, cost; i <= K; ++i) {
    cin >> nod >> cost;
    D[nod] = min(D[nod], cost);
    mod[nod] = true;
  }
  for (int i = 1; i <= N; ++i)
    if (D[i] != INF) Q.push(make_pair(-D[i], i));
  while (!Q.empty()) {
    auto now = Q.top();
    Q.pop();
    if (D[now.second] != -now.first) continue;
    for (auto edge : V[now.second])
      if (D[now.second] + edge.second < D[edge.first]) {
        D[edge.first] = D[now.second] + edge.second;
        mod[edge.first] = false;
        Q.push(make_pair(-D[edge.first], edge.first));
      } else if (D[now.second] + edge.second == D[edge.first])
        mod[edge.first] = false;
  }
  int result = K;
  for (int i = 1; i <= N; ++i) result -= mod[i];
  cout << result << '\n';
}
