#include <bits/stdc++.h>
using namespace std;
vector<pair<int, int>> g[100000];
int dist[100000] = {};
vector<pair<int, int>> trains;
int dijkstra(int n, int start) {
  set<pair<int, int>> vs;
  vs.insert(make_pair(0, start));
  for (int i = 0; i < n; ++i) {
    dist[i] = INT_MAX;
  }
  dist[start] = 0;
  for (auto pi : trains) {
    int w = pi.first;
    int cost = pi.second;
    if (cost < dist[w]) {
      vs.erase(make_pair(dist[w], w));
      dist[w] = cost;
      vs.insert(make_pair(dist[w], w));
    }
  }
  int usedTrains = 0;
  while (!vs.empty()) {
    auto p = *vs.begin();
    vs.erase(vs.begin());
    if (p.second > 0) {
      ++usedTrains;
    } else {
      p.second = -p.second;
    }
    int v = p.second;
    for (const auto& e : g[v]) {
      int w = e.first;
      if (dist[v] + e.second <= dist[w]) {
        vs.erase(make_pair(dist[w], w));
        vs.erase(make_pair(dist[w], -w));
        dist[w] = dist[v] + e.second;
        vs.insert(make_pair(dist[w], -w));
      }
    }
  }
  return usedTrains;
}
int main() {
  int n, m, k;
  cin >> n >> m >> k;
  for (int i = 0; i < m; ++i) {
    int u, v, x;
    cin >> 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, y;
    cin >> s >> y;
    --s;
    trains.push_back(make_pair(s, y));
  }
  cout << k - dijkstra(n, 0) << endl;
}
