#include <bits/stdc++.h>
using namespace std;
using pi = pair<long long, long long>;
vector<pi> adj[100005];
pair<long long, pi> a[400005];
long long b[100005];
int main() {
  long long n, m, k, u, v, w;
  cin >> n >> m >> k;
  for (long long i = 0; i < m; i++) {
    cin >> u >> v >> w;
    a[i].first = u;
    a[i].second.first = v;
    a[i].second.second = w;
    adj[u].push_back({v, w});
    adj[v].push_back({u, w});
  }
  for (long long i = 0; i < k; i++) {
    cin >> u >> w;
    a[m + i].first = 1;
    a[m + i].second.first = u;
    a[m + i].second.second = w;
    adj[1].push_back({u, w});
    adj[u].push_back({1, w});
  }
  priority_queue<pi, vector<pi>, greater<pi> > pq;
  vector<long long> dist(n + 1, 1e9);
  dist[1] = 0;
  pq.push({0, 1});
  while (!pq.empty()) {
    long long d = pq.top().first;
    long long u = pq.top().second;
    pq.pop();
    if (dist[u] != d) continue;
    for (auto nx : adj[u]) {
      long long v = nx.first;
      long long w = nx.second;
      if (d + w < dist[v]) {
        dist[v] = d + w;
        pq.push({dist[v], v});
      }
    }
  }
  for (long long i = 0; i < m + k; i++) {
    if (dist[a[i].first] + a[i].second.second == dist[a[i].second.first]) {
      b[a[i].second.first]++;
    } else if (dist[a[i].second.first] + a[i].second.second ==
               dist[a[i].first]) {
      b[a[i].first]++;
    }
  }
  long long x = 0;
  for (long long i = m; i < m + k; i++) {
    if (dist[a[i].first] + a[i].second.second == dist[a[i].second.first]) {
      if (b[a[i].second.first] > 1) {
        b[a[i].second.first]--;
        x++;
      }
    } else
      x++;
  }
  cout << x;
  return 0;
}
