#include <bits/stdc++.h>
using namespace std;
vector<pair<int, long long> > G[100100];
vector<pair<int, int> > trains;
int n, m, k, indegree[100100], outdegree[100100];
long long dist[100100];
const long long INF = 100000000000000;
void dijkstra(int source, long long* dist) {
  for (int i = 0; i < n; i++) dist[i + 1] = INF;
  dist[source] = 0;
  set<pair<long long, int> > Q;
  for (int i = 1; i <= n; i++)
    if (i != source) Q.insert({INF, i});
  Q.insert({0, source});
  while (!Q.empty()) {
    auto it = Q.begin();
    int x = it->second;
    Q.erase(it);
    for (auto i : G[x]) {
      long long v = i.first, w = i.second;
      if (dist[x] + w < dist[v]) {
        Q.erase(Q.find({dist[v], v}));
        dist[v] = dist[x] + w;
        Q.insert({dist[v], v});
      }
    }
  }
}
int main() {
  ios::sync_with_stdio(false);
  cin >> n >> m >> k;
  for (int i = 0; i < n + 10; i++) {
    G[i].clear(), indegree[i] = 0, outdegree[i] = 0;
  }
  for (int i = 0, u, v, w; i < m; i++) {
    cin >> u >> v >> w;
    u--;
    v--;
    G[u].push_back({v, w});
    G[v].push_back({u, w});
  }
  for (int i = 0, u, w; i < k; i++) {
    cin >> u >> w;
    u--;
    G[u].push_back({0, w});
    G[0].push_back({u, w});
    trains.push_back({u, w});
  }
  dijkstra(0, dist);
  for (int i = 0; i < n; i++) {
    for (auto j : G[i]) {
      int u = i, v = j.first, w = j.second;
      if (dist[u] == dist[v] + w) {
        indegree[u]++;
        outdegree[v]++;
      }
    }
  }
  int deletable = 0;
  for (auto edge : trains) {
    int u = 0, v = edge.first, w = edge.second;
    if (dist[v] == dist[u] + w) {
      if ((outdegree[u] > 1) and (indegree[v] > 1)) {
        outdegree[u]--;
        indegree[v]--;
        deletable++;
      }
    } else {
      deletable++;
    }
  }
  cout << deletable << "\n";
}
