#include <bits/stdc++.h>
using namespace std;
vector<vector<pair<long long, long long>>> adj;
vector<long long> d;
long long n;
vector<bool> mark;
vector<long long> trains;
void dijktras(long long s) {
  d[s] = 0;
  priority_queue<pair<long long, long long>, vector<pair<long long, long long>>,
                 greater<pair<long long, long long>>>
      pq;
  pq.push({0, s});
  for (long long i = 2; i <= n; i++) {
    if (trains[i] != INT_MAX) pq.push({trains[i], i});
  }
  while (!pq.empty()) {
    long long v = pq.top().second;
    long long d_v = pq.top().first;
    pq.pop();
    if (d_v != d[v]) continue;
    for (auto edge : adj[v]) {
      long long to = edge.first;
      long long len = edge.second;
      if (d[to] > d[v] + len) {
        d[to] = d[v] + len;
        pq.push({d[to], to});
      } else if (d[to] == d[v] + len) {
        if (d[to] == trains[to]) mark[to] = true;
      }
    }
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long m, k;
  cin >> n >> m >> k;
  adj.resize(n + 1);
  d.assign(n + 1, INT_MAX);
  mark.assign(n + 1, false);
  while (m--) {
    long long u, v, w;
    cin >> u >> v >> w;
    adj[u].push_back({v, w});
    adj[v].push_back({u, w});
  }
  long long ans = 0;
  trains.assign(n + 1, INT_MAX);
  while (k--) {
    long long s, y;
    cin >> s >> y;
    if (d[s] == INT_MAX) {
      d[s] = y;
      trains[s] = y;
    } else {
      ans++;
      trains[s] = min(trains[s], y);
      d[s] = min(d[s], y);
    }
  }
  dijktras(1);
  for (int i = 2; i <= n; i++)
    if (d[i] < trains[i] && trains[i] != INT_MAX) {
      mark[i] = true;
    }
  for (int i = 2; i <= n; i++)
    if (mark[i]) ans++;
  cout << ans << "\n";
  cout << "\n";
  return 0;
}
