#include <bits/stdc++.h>
using namespace std;
const long long MAX = 100005;
const long long mod = 1e12;
long long cnt;
struct edge {
  long long v, w, f;
};
int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long n, m, k;
  cin >> n >> m >> k;
  vector<edge> adjlist[n + 1];
  long long i, j, x, y, z;
  for (i = 0; i < m; i++) {
    cin >> x >> y >> z;
    adjlist[x].push_back({y, z, 0});
    adjlist[y].push_back({x, z, 0});
  }
  vector<pair<long long, long long> > q;
  for (i = 0; i < k; i++) {
    cin >> y >> z;
    q.push_back({y, z});
    x = 1;
    adjlist[x].push_back({y, z, 1});
    adjlist[y].push_back({x, z, 1});
  }
  vector<long long> dist(n + 5, 0);
  for (i = 1; i <= n; i++) {
    dist[i] = mod;
  }
  set<pair<long long, long long> > s;
  s.insert({0, 1});
  dist[1] = 0;
  vector<long long> f(n + 1, 0);
  while (s.size() > 0) {
    auto p = *(s.begin());
    s.erase(p);
    for (auto it : adjlist[p.second]) {
      if (dist[it.v] > (dist[p.second] + it.w) ||
          (dist[it.v] == (dist[p.second] + it.w) && it.f == 0)) {
        s.erase({dist[it.v], it.v});
        dist[it.v] = (dist[p.second] + it.w);
        s.insert({dist[it.v], it.v});
        f[it.v] = it.f;
      }
    }
  }
  long long cnt = 0;
  for (i = 2; i <= n; i++) {
    cnt += f[i];
  }
  cout << k - cnt << "\n";
  return 0;
}
