#include <bits/stdc++.h>
using namespace std;
vector<pair<long long, long long>> v[1000007];
priority_queue<pair<long long, long long>, vector<pair<long long, long long>>,
               greater<pair<long long, long long>>>
    pq;
long long d[1000007];
bool ok[1000007], f[1000007];
long long n, m, k;
long long dijkstra() {
  pq.push({0, 1});
  d[1] = 0;
  while (!pq.empty()) {
    long long x = pq.top().second;
    pq.pop();
    if (f[x]) continue;
    f[x] = 1;
    for (auto i : v[x]) {
      long long b = i.second, w = i.first;
      if (d[x] + w <= d[b]) {
        ok[b] = 0;
        d[b] = d[x] + w;
        pq.push({d[b], b});
      }
    }
  }
  long long c = 0;
  for (long long i = 1; i <= n; i++)
    if (ok[i]) c++;
  return k - c;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cin >> n >> m >> k;
  for (long long i = 1; i <= m; i++) {
    long long a, b, w;
    cin >> a >> b >> w;
    v[a].push_back({w, b});
    v[b].push_back({w, a});
  }
  for (long long i = 1; i <= n; i++) d[i] = LLONG_MAX;
  for (long long i = 1; i <= k; i++) {
    long long b, w;
    cin >> b >> w;
    ok[b] = 1;
    if (d[b] < w) continue;
    d[b] = w;
    pq.push({w, b});
  }
  cout << dijkstra() << "\n";
  return 0;
}
