#include <bits/stdc++.h>
using namespace std;
const long long inf = 1e18;
long long n, m, k;
vector<vector<pair<long long, long long>>> edges;
vector<long long> dist;
void test_cases() {
  long long n, m, k;
  cin >> n >> m >> k;
  edges.resize(n + 1);
  for (long long i = 0; i < m; i++) {
    long long u, v, x;
    cin >> u >> v >> x;
    edges[u].push_back({-v, x});
    edges[v].push_back({-u, x});
  }
  long long ans = k;
  for (long long i = 0; i < k; i++) {
    long long x, y;
    cin >> x >> y;
    edges[1].push_back({x, y});
    edges[x].push_back({1, y});
  }
  dist.assign(n + 1, inf);
  dist[1] = 0ll;
  set<pair<long long, long long>> s;
  s.insert({0ll, -1});
  vector<bool> vis(n + 1, 0);
  while (!s.empty()) {
    pair<long long, long long> p = *s.begin();
    long long node = abs(p.second);
    s.erase(p);
    if (vis[node]) {
      continue;
    }
    if (p.second > 0) {
      ans--;
    }
    vis[node] = 1;
    for (pair<long long, long long> q : edges[node]) {
      long long to = abs(q.first);
      long long d = q.second;
      if (dist[to] > dist[node] + d) {
        dist[to] = dist[node] + d;
        s.insert({dist[to], q.first});
      } else if (dist[to] == dist[node] + d) {
        s.insert({dist[to], q.first});
      }
    }
  }
  cout << ans << "\n";
}
int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long tt = 1;
  while (tt--) {
    test_cases();
  }
  return 0;
}
