#include <bits/stdc++.h>
long long max(long long a, long long b) { return (a < b) ? b : a; }
long long min(long long a, long long b) { return (a > b) ? b : a; }
using namespace std;
vector<pair<long long, long long> > edg[200100];
long long train[200100], dp[200100], vis[200100];
int main() {
  long long n, m, k, a, b, c;
  cin >> n >> m >> k;
  for (long long i = 0; i < m; i++)
    scanf("%lld%lld%lld", &a, &b, &c), edg[a].push_back(make_pair(b, c)),
        edg[b].push_back(make_pair(a, c));
  for (long long i = 2; i < n + 1; i++) dp[i] = LLONG_MAX / 2;
  priority_queue<pair<long long, long long> > q;
  q.push(make_pair(0, 1));
  for (long long i = 0; i < k; i++)
    scanf("%lld%lld", &a, &c), dp[a] = min(dp[a], c), train[a] = 1;
  for (long long i = 1; i < n + 1; i++)
    if (train[i]) q.push(make_pair(-dp[i], i));
  while (q.size()) {
    long long u = q.top().second, neki = q.top().first;
    q.pop();
    if (dp[u] == -neki) {
      vis[u] = 1;
      for (auto&& v : edg[u]) {
        if (dp[v.first] >= dp[u] + v.second) train[v.first] = 0;
        if (dp[v.first] > dp[u] + v.second)
          dp[v.first] = dp[u] + v.second,
          q.push(make_pair(-dp[v.first], v.first));
      }
    }
  }
  long long ans = 0;
  for (long long i = 1; i < n + 1; i++) ans += train[i];
  cout << k - ans << endl;
}
